Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
After applying the TOP N filter to a table visual im left with an extra row due to a tie breaker, therefore i'm looking to create a RANKX measure using an additional value to break this tie breaker when a tie occurs.
Since there is a tie when using count i would like to break the tie by using the 'Amount' Column which would place the row with 28 in the first rank, and 24 displaying Rank 2
Thank you to everyone in advance for the help!
Solved! Go to Solution.
Hi @Anonymous ,
You can create this measure to calculate:
Rank =
VAR a =
CALCULATETABLE (
FILTER (
DISTINCT ( 'Table'[Food] ),
RANKX (
ALLSELECTED ( 'Table' ),
CALCULATE ( COUNT ( 'Table'[Heath Rating] ) ),
,
DESC,
DENSE
) = 1
),
ALLSELECTED ()
)
RETURN
IF (
CALCULATE ( COUNTROWS ( 'Table' ), 'Table'[Food] IN a ) = 0,
BLANK (),
RANKX (
GROUPBY (
FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Food] IN a ),
'Table'[Heath Rating]
),
CALCULATE ( SUM ( 'Table'[Amount] ), 'Table'[Food] IN a ),
,
DESC,
DENSE
)
)
Attached a sample file in the below, hopes it could help.
Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
You can create this measure to calculate:
Rank =
VAR a =
CALCULATETABLE (
FILTER (
DISTINCT ( 'Table'[Food] ),
RANKX (
ALLSELECTED ( 'Table' ),
CALCULATE ( COUNT ( 'Table'[Heath Rating] ) ),
,
DESC,
DENSE
) = 1
),
ALLSELECTED ()
)
RETURN
IF (
CALCULATE ( COUNTROWS ( 'Table' ), 'Table'[Food] IN a ) = 0,
BLANK (),
RANKX (
GROUPBY (
FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Food] IN a ),
'Table'[Heath Rating]
),
CALCULATE ( SUM ( 'Table'[Amount] ), 'Table'[Food] IN a ),
,
DESC,
DENSE
)
)
Attached a sample file in the below, hopes it could help.
Best Regards,
Community Support Team _ Yingjie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Please see this article/video.
RANKX on multiple columns with DAX and Power BI - SQLBI
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
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 |
|---|---|
| 48 | |
| 45 | |
| 41 | |
| 20 | |
| 17 |
| User | Count |
|---|---|
| 69 | |
| 64 | |
| 32 | |
| 31 | |
| 27 |