- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ranking a table variable
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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! | |
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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! | |
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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 |
Helpful resources
Join us at the Microsoft Fabric Community Conference
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Power BI Monthly Update - January 2025
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
Subject | Author | Posted | |
---|---|---|---|
05-01-2023 03:35 AM | |||
05-22-2024 01:44 AM | |||
08-02-2024 06:12 AM | |||
07-12-2024 05:33 AM | |||
04-03-2024 07:38 AM |
User | Count |
---|---|
95 | |
71 | |
44 | |
38 | |
29 |
User | Count |
---|---|
156 | |
92 | |
61 | |
44 | |
42 |