Forum Discussion
Calculated Measure
Hi All,
I have a calculated measure which gives me values based on IF condition
Measure5 = IF(Measure1 > Measure2 && Measure3 > Measure4, Measure1,0)
When i use this measure for a dimension say 'Customer' in a table viz, i am getting exact values as:
Measure1 values for some customers and 0's for rest of them
For Ex: Customer Measure5
Cus1 21%
Cus2 0%
Cus4 0%
Cus4 0%
Cus5 32%
Total 100%
Actually Measure5 will give Percentage values thats y um getting 100% in the 'Total' row.
But my requirement is to get the total of the Measure5 values that is (21+32 = 53%) in the total row instead of getting 100% in the total row.
How can i achieve this..?
I have seen that the 'Default Summarization' Property in the 'Modeling' tab is greyed out for every 'Measure', um not even sure that this will gonna give me the exact solution what um looking for, if i change the default summarization property to sum or something.
guy's please help me out with this.
Thanks in Advance.
10 Replies
- itayromResolver II
The "Default Summarization" property is greyed out because measures are inherently summarizations, since they basically perform calculations on groups of values and return a single result. Otherwise, they would just be calculated columns.
The totals shown in visuals that request sub-totals from Power BI(such as the Table and Matrix visuals) are the result of the summarization function performed on the values of all the items for whom the sub-totals were requested. Therefore, the 100% total you're getting is not the summation of each customer's Measure5 result, but rather the result of Measure5 calculated on all the customers. The same goes for all the measures used internally by Measure5(I'd recommend reading about row and filter contexts in DAX if you're not already familiar with that topic).
If you'd like the total to be a summation, one option would be implementing Measure5 as a calculated column(if at all possible) and set its summarization option to "Sum".
- AnonymousNot applicable
thanks for the reply itayrom.
all the columns um using in the calculation are measures and when i try to create a calulated column instead of a measure um getting the following error.
"Function 'SUM' is not allowed as part of calculated column DAX expressions on DirectQuery models"
Should i create calculated columns instead of measures for all those Measure1 to Measure4 to perform the sum operation for Measure5 which should also be a calculated column instead of a measure...?
- v-haibl-msftMicrosoft Employee
Anonymous
I guess that you’ve used SUM function in Measure1 to Measure4. According to this article, SUM is only supported in measure when using DirectQuery mode.
If you use Import mode here, you should be able to get the expected result by only changing Measure5 to Column5.
Best Regards,
Herbert