Get certified for free when you join Fabric Data Days 2026 and dive into Fabric, Power BI, SQL, AI, and other essential data skills.
Join nowJuly 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more
Hello, mates!
I have the following question that I have no idea what can I do:
I have a table called 'Sections' with this columns:
And for each ID and WAY I must rank this line IDs, ordering the sections based on distance between FROM and TO.
An exemple:
| SECTIONS TABLE | ||||
| ID | FROM | TO | DISTANCE | WAY |
| 1 | A | B | 10 | going |
| 1 | A | C | 25 | going |
| 1 | A | D | 42 | going |
| 1 | B | C | 15 | going |
| 1 | B | D | 32 | going |
| 1 | C | D | 17 | going |
| 2 | R | S | 50 | going |
| 2 | R | T | 70 | going |
| 2 | S | T | 20 | going |
| 1 | D | A | 42 | return |
| 1 | D | B | 32 | return |
| 1 | D | C | 17 | return |
| 1 | C | A | 25 | return |
| 1 | C | B | 15 | return |
| 1 | B | A | 10 | return |
| 2 | T | R | 70 | return |
| 2 | T | S | 20 | return |
| 2 | S | R | 50 | return |
My expect result:
| RANKED SECTIONS | |||
| ID | SECCION | WAY | RANK |
| 1 | A | going | 1 |
| 1 | B | going | 2 |
| 1 | C | going | 3 |
| 1 | D | going | 4 |
| 1 | D | return | 1 |
| 1 | C | return | 2 |
| 1 | B | return | 3 |
| 1 | A | return | 4 |
| 2 | R | going | 1 |
| 2 | S | going | 2 |
| 2 | T | going | 3 |
| 2 | T | return | 1 |
| 2 | R | return | 2 |
| 2 | S | return | 3 |
Please help me! 😞
🙂
Solved! Go to Solution.
Try this:
Rank X 2 = VAR Filt = SELECTEDVALUE(Table2[Filter]) Return RANKX ( FILTER(ALL ( Table2 );Table2[Filter]=Filt); [Dist] )
Table2[Filter] is a calculated column:
Filter = Table2[ID] & Table2[Way]
[Dist] is a measure:
Dist = SUM(Table2[Distance])
Try this:
Rank X = VAR Val = Table2[ID] VAR Val2 = Table2[Way] Return RANKX(FILTER(Table2;Table2[ID]=Val && Table2[Way] = Val2); Table2[Distance])
I am not able to set a table[column] as a VAR
Try this:
Rank X 2 = VAR Filt = SELECTEDVALUE(Table2[Filter]) Return RANKX ( FILTER(ALL ( Table2 );Table2[Filter]=Filt); [Dist] )
Table2[Filter] is a calculated column:
Filter = Table2[ID] & Table2[Way]
[Dist] is a measure:
Dist = SUM(Table2[Distance])
Ohh, you are making a measure and not a calculated column?
Un momento!
Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.
If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!
Check out the July 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 30 | |
| 26 | |
| 23 | |
| 23 | |
| 14 |
| User | Count |
|---|---|
| 46 | |
| 33 | |
| 20 | |
| 18 | |
| 16 |