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 moreJoin the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now
Hi members,
I would require your support to compare duplicated data that is obtained via RANKX function
I used RANKX to create an index based on another column (Date) using DAX command
Now this column has duplicated values. I would like to compare values with another column if there is duplication and then I would like to Rank this column.
Example:
Expected calculation:
Step 1: Date has to be sorted in ascending order;
Step 2: Then if the index values are same, they should be sorted according to the ascending order of the machine number
| Raw input | |||
| S.No | Date | Machine number | Created Index value |
| A1212 | 01.08.2021 | 5 | 1 |
| A1213 | 07.08.2021 | 1 | 3 |
| A1214 | 01.08.2021 | 3 | 1 |
| A1215 | 06.08.2021 | 5 | 2 |
| A1216 | 08.08.2021 | 2 | 4 |
| A1217 | 01.08.2021 | 1 | 1 |
| Expected calculation | |||
| A1217 | 01.08.2021 | 1 | 1 |
| A1214 | 01.08.2021 | 3 | 2 |
| A1212 | 01.08.2021 | 5 | 3 |
| A1215 | 06.08.2021 | 5 | 4 |
| A1213 | 07.08.2021 | 1 | 5 |
| A1216 | 08.08.2021 | 2 | 6 |
Solved! Go to Solution.
Hi, @Jo5hua22
Please try formulas as below:
Created Index value = RANKX('Table','Table'[Date],,ASC,Dense)machine number Ranked = RANKX('Table','Table'[S.No],,DESC,Dense)Result =
VAR machine_ranked =
MAX ( 'Table'[machine number Ranked] ) //Maximum value of sub-column(machine)=5
VAR result =
RANKX (
ALL ( 'Table' ),
'Table'[Created Index value] * machine_ranked + 'Table'[machine number Ranked],
//Rank of the main column * 5+ the rank of the sub-column
,
ASC,
DENSE
)
RETURN
result
Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @Jo5hua22
Please try formulas as below:
Created Index value = RANKX('Table','Table'[Date],,ASC,Dense)machine number Ranked = RANKX('Table','Table'[S.No],,DESC,Dense)Result =
VAR machine_ranked =
MAX ( 'Table'[machine number Ranked] ) //Maximum value of sub-column(machine)=5
VAR result =
RANKX (
ALL ( 'Table' ),
'Table'[Created Index value] * machine_ranked + 'Table'[machine number Ranked],
//Rank of the main column * 5+ the rank of the sub-column
,
ASC,
DENSE
)
RETURN
result
Best Regards,
Community Support Team _ Eason
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Please post your DAX to know the issue ... (Always, issue, data, code, expected output helps the community to answer)
It looks like you are trying to do is SQL's DENSE_RANK.
Check these two articles
https://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures
https://community.powerbi.com/t5/Desktop/Rank-based-on-date-for-each-individual-user/td-p/411053
Thanks
Check out the April 2026 Power BI update to learn about new features.
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.
| User | Count |
|---|---|
| 11 | |
| 10 | |
| 9 | |
| 8 | |
| 8 |