Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi
I have a table of alarms filtered by data, now I would like make a Top N function, where the user can select the "See top N alarms". For this I have be trying to use the RANKX function, but i cannot get it for work proberly. Rank will not be done correltly in relation to the count. Seems that when the function finds and Alarm text that is used for more than one AlarmID, then it will not rank corretly
I would like the function to rank my AlarmID based counts.
Rank N = RANKX(all(Alarms[AlarmID]);[CountRows])
CountRows = COUNT(Alarms[AlarmID])
Here is my filtered data that I am trying to rank
AlarmID | Alarm text | Count of AlarmID | CountRows | Rank N | Top N within selected N |
1000 | Emergency stop activated - 130S5 | 2 | 2 | 1 | 1 |
1001 | Power on is not activated - 131S2/131S5 | 2 | 2 | 1 | 1 |
1002 | Safety door is not closed - 140K4 | 21 | 21 | 1 | 1 |
1003 | Inlet safety gate is not closed - 146B5 - 145B11 | 2 | 2 | 1 | 1 |
1004 | Outlet safety gate is not closed - 146B5 - 146B11 | 1 | 1 | 1 | 1 |
3086 | No alarm text specified in HMI | 3 | 3 | 5 | 1 |
3097 | No alarm text specified in HMI | 59 | 59 | 1 | 1 |
3098 | No alarm text specified in HMI | 55 | 55 | 2 | 1 |
5000 | EM01 - Conveyor not initialized | 9 | 9 | 1 | 1 |
5001 | EM02 - Fixture 1 not initialized | 9 | 9 | 1 | 1 |
5002 | EM03 - Fixture 2 not initialized | 9 | 9 | 1 | 1 |
5003 | EM04 - Robot not initialized | 8 | 8 | 1 | 1 |
5004 | EM05 - Butyl not initialized | 8 | 8 | 1 | 1 |
5020 | No alarm text specified in HMI | 11 | 11 | 4 | 1 |
5130 | No alarm text specified in HMI | 27 | 27 | 3 | 1 |
Solved! Go to Solution.
This is all to do with context - and it's not straightforward to understand. I think this is why RANKX causes so much confusion. I'm pretty sure your Rank measure will work if you remove 'Alarm Text' from the visualisation.
When 'Alarm Text' is in the visualisation, it changes the context and you can see that in your example, it works only for rows where the text is the same.
If you ever need to work out what RANKX is doing, investigate RADACAD's concatenatex technique.
Short answer : If you want 'Alarm Text' in the visualisation, use
This is all to do with context - and it's not straightforward to understand. I think this is why RANKX causes so much confusion. I'm pretty sure your Rank measure will work if you remove 'Alarm Text' from the visualisation.
When 'Alarm Text' is in the visualisation, it changes the context and you can see that in your example, it works only for rows where the text is the same.
If you ever need to work out what RANKX is doing, investigate RADACAD's concatenatex technique.
Short answer : If you want 'Alarm Text' in the visualisation, use
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 |
---|---|
114 | |
100 | |
81 | |
70 | |
62 |
User | Count |
---|---|
148 | |
116 | |
104 | |
90 | |
65 |