Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
I have a table of vehicles that have regular inspections. The same vehicle will appear in the table more than once. Sometimes that vehicle will pass an inspection and soemtimes it will fail. I need to calculate the percentage of inspections that result in a pass. It seems like this should be easy but the measure I'm using always returns 100% when I drag the vehicle ID in. The % is correct when I use a basic card that aggregates across the entire table.
The (rough) DAX I'm using at the moment:
VAR numberOfInspections = COUNTX('inspections', 'inspections'[_index])
Solved! Go to Solution.
Hi,
Try these measures:
Row count = COUNTROWS(Data)
Pass count = CALCULATE([Row count],Data[pass]=TRUE())
Pass % = DIVIDE([Pass count],[Row count])
Hope this helps.
Hope this satisfies your requirement, if yes, kindly mark the answer as correct so that it can help others as well
This should work >>>
Step 1
The below is an anonymised example. I'd expect to see 50% returned for each vehicle with these values.
vehicle | pass |
vehicle 1 | TRUE |
vehicle 2 | FALSE |
vehicle 3 | TRUE |
vehicle 1 | FALSE |
vehicle 2 | TRUE |
vehicle 3 | FALSE |
Hi,
Try these measures:
Row count = COUNTROWS(Data)
Pass count = CALCULATE([Row count],Data[pass]=TRUE())
Pass % = DIVIDE([Pass count],[Row count])
Hope this helps.
Many thanks
You are welcome.
Use ALL so that it can come out of the Row Context there .....
Use this DAX = VAR numberOfInspections = COUNTX(ALL('inspections'), 'inspections'[_index])
Regards,
Ritesh
Regards,
Ritesh
Mark my post as a solution if it helped you| Munde and Kudis (Ladies and Gentlemen) I like your Kudos!! !!
My YT Channel Dancing With Data !! Connect on Linkedin !!Power BI for Tableau Users
Thanks for the input. Unfortunately it hasn't solved the situation
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
102 | |
84 | |
79 | |
68 |
User | Count |
---|---|
120 | |
110 | |
94 | |
81 | |
77 |