开发者

DevExpress ASPxPivotGrid Custom Summary Calculation for unbound fields

开发者 https://www.devze.com 2023-02-28 21:25 出处:网络
I am evaluating ASPxPivotGrid.So far, it\'s perfect for what I need to do and I\'m ready to buy it, but I have one hiccup that I don\'t understand how to implement.I need to do calculations on fields.

I am evaluating ASPxPivotGrid. So far, it's perfect for what I need to do and I'm ready to buy it, but I have one hiccup that I don't understand how to implement. I need to do calculations on fields. That part I think I get, I create an unbound field and enter the formula I want. That works fine. The problem is the summary data defaults to Sum, which I don't wa开发者_JS百科nt since it's a percentage calculation. For instance:

Bound Fields: Sales, Profit

Unbound Field Calculation = Profit / Sales * 100

This is to calculate the Profit Margin %.

Like I said it works when the pivot displays raw data, but once it summarizes, I want it to calculate the Profit Margin % on the summarized totals of Profit and Sales. So, something like this:

Summary Profit Margin % = Sum(Profit) / Sum(Sales) * 100

I have searched on their forum and see what seems like related material on the subject, but I don't know enough about the product to make sense of what I should be doing either in the property settings or in code. There does not seem to be a clear tutorial or explanation of this anywhere.


If I understand your task properly, you want to calculate expressions based on data shown in PivotGrid cells. If so, this behavior is controlled by the OptionsData.DataFieldUnboundExpressionMode option. In your case, you should set this property to the DataFieldUnboundExpressionMode.UseSummaryValues value. We have shown this functionality in Winforms and WPF UnboundExpression demo. There is a drawback though. Expression's total value will be calculated in the same manner - i.e. expression will be applied to total values in the same row. I hope, this information will be helpful to you.

0

精彩评论

暂无评论...
验证码 换一张
取 消