Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreWe've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
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!
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 53 | |
| 39 | |
| 35 | |
| 19 | |
| 18 |
| User | Count |
|---|---|
| 73 | |
| 73 | |
| 38 | |
| 35 | |
| 26 |