Forum Discussion
Simple Calculation required
- 7 years ago
Hi shere100
You may create a measure with COUNTX Function.For example:
Measure 2 = COUNTX ( FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Test Result] = "Pass" ), 'Table'[Test Result] ) / COUNTX ( FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Test Result] = "Not Started" ), 'Table'[Test Result] )Regards,
Hi shere100
You may create a measure and then set the measure's format %.
Measure =
SUMX ( FILTER ( Table2, Table2[Status] = "Pass" ), Table2[Value] )
/ SUMX ( FILTER ( Table2, Table2[Status] = "Not Started" ), Table2[Value] )
Regards,
- shere1007 years agoHelper II
Thanks for the above, much appreciated.
The values in the orignal post are based not from the raw data but from the filters selected on a visual and the results displayed
How do I then use the measure on the filtered values? If I use the query you have kindly provided me this will not calculate the totals for each status and then measure the totals?
Or how would I calculate the results from the raw data then use the measure calculation you have provided?
- v-cherch-msft7 years agoMicrosoft Employee
Hi shere100
You may try to use ALLSELECTED Function.For example:
Measure = SUMX ( FILTER ( ALLSELECTED ( Table2 ), Table2[Status] = "Pass" ), Table2[Value] ) / SUMX ( FILTER ( ALLSELECTED ( Table2 ), Table2[Status] = "Not Started" ), Table2[Value] )Regards,
- shere1007 years agoHelper II
Hi, thanks for the response. I get the following message.
Error Message:
MdxScript(Model) (28, 5) Calculation error in measure 'Test Result 2'[Measure 6]: The function SUMX cannot work with values of type String.To clarify I need to calculate the sum for a status that has string values. The above message appears when I attempt to run the measure.
v-cherch-msft wrote:Hi shere100
You may try to use ALLSELECTED Function.For example:
Measure = SUMX ( FILTER ( ALLSELECTED ( Table2 ), Table2[Status] = "Pass" ), Table2[Value] ) / SUMX ( FILTER ( ALLSELECTED ( Table2 ), Table2[Status] = "Not Started" ), Table2[Value] )Regards,