Forum Discussion
Simple Calculation required
Hi, I need to do some simple percentage calaculation on two columns.
| Not Started | 56 |
| Pass | 20 |
| Fail | 2 |
| Total Work Items | 78 |
I need to display the percentage of success rate. I.e the calculation would be 20 (pass) / 56 (not started) * 100.
Can you please talk me through the process. Thanks
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,
16 Replies
- v-cherch-msftMicrosoft Employee
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,
- shere100Helper 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-msftMicrosoft 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,