Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.
Check it out now!Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more
Hi. I have a table variable created using calculatetable in a dax measure. I need to rank this table based on column [Value]. I can do that with Rankx. However, it seemst that Rankx doesn't take the decimal points into consideration because I have two values (6.5 and 6.3) in the table, but it seems to give both of them the same rank. I was told that I should use Rank function to resolve this issue. However, it seems that Rank doesn't work with calculated table variables in a measure. Is there a way to make Rankx consider two decimal places? If not, will Rank work? Will it work on a table variable? Thanks.
Solved! Go to Solution.
Consider wrapping your measure results in a round function, with multiple decimal points (e.g. ROUND([Value],3), and RANKX from there. This was you can determine if it truly is a rounding issue (i.e. Rankx not picking up the decimals)
Proud to be a Super User! | |
Consider wrapping your measure results in a round function, with multiple decimal points (e.g. ROUND([Value],3), and RANKX from there. This was you can determine if it truly is a rounding issue (i.e. Rankx not picking up the decimals)
Proud to be a Super User! | |
Thanks, @ExcelMonke . You are right. I mistakenly thought that it truncated the decimals. When I dug deeper, I found that both numbers were identical, so the ranks were also identical. The problem now is that i'm later selecting from that table that has several rows with two of them having the same rank. The problem is in the next step where i select the top 5 values based on their ranks. So, I go like "give me the value where rank is 1; give me the value where rank is 2, ... where rank is 5." If the table has the below values, then I will be getting A, B, C, D and F as items with ranks 1, 2, 3, 4, 5 -- when I really should be getting E instead of F because E has a value of 7, but E is 6. I mean, it makes a difference in the context of the report.
ID | Value | Rank |
A | 10 | 1 |
B | 9 | 2 |
C | 8 | 3 |
D | 7 | 4 |
E | 7 | 4 |
F | 6 | 5 |