Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi everyone,
I am looking to rank my Orders based on the USER ID (repeats) and DATE, but only for completed orders.
I have this DAX for a calculated column, but as you can see, it isn't working correctly for some reason.
DAX:
Rank Column =
VAR d = Orders[Completed At]
VAR c = Orders[User Id]
RETURN
CALCULATE (
RANK.EQ ( d, Orders[Completed At], ASC ),
FILTER ( ALL ( Orders ), Orders[Status]="Completed"), Orders[User Id] = c )
Results:
| User Id | Completed At | Status | Rank Column | ||
| 10028 | 2/21/21 | COMPLETED | 1 | ||
| 10028 | 2/23/21 | COMPLETED | 2 | ||
| 10028 | 9/10/21 | COMPLETED | 3 | ||
| 10160 | 7/12/21 | CANCELED | |||
| 10160 | 8/23/21 | COMPLETED | 1 | ||
| 10160 | 10/5/21 | COMPLETED | 4 | ||
| 10160 | 11/22/21 | COMPLETED | 5 |
For some reason, the ranking didn't work for the USER ID "10160"
Does it have to do with my filtering for [Status]=Completed ?
Thank you for the help!!
Solved! Go to Solution.
Rank CC =
VAR currentid = Orders[User Id]
VAR newtable =
FILTER ( Orders, Orders[User Id] = currentid && Orders[Status] = "COMPLETED" )
RETURN
IF (
Orders[Status] = "COMPLETED",
RANKX ( newtable, Orders[Completed At],, ASC )
)
Rank CC =
VAR currentid = Orders[User Id]
VAR newtable =
FILTER ( Orders, Orders[User Id] = currentid && Orders[Status] = "COMPLETED" )
RETURN
IF (
Orders[Status] = "COMPLETED",
RANKX ( newtable, Orders[Completed At],, ASC )
)
How can you get this to work if you have a tie with the dates. I.e the same dates under the same id and you need it to give a different rank based on the row order. I don't have access to the query editor for this table.
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 99 | |
| 76 | |
| 56 | |
| 51 | |
| 46 |