Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Syndicate_Admin
Administrator
Administrator

Unresolved problem with RANKX in DAX, repeated values with no result required

Good people!
I need a help with the following in DAX. I have the table presented below with the data of amounts of each credit and its corresponding data of Amounts and Dates of Settlement and Granting.

jhuici_2-1685542262010.png

As visualized by the RankX measure ( = RANKX (ALLSELECTED('Credits'),[AmountsDiv1000],,DESC,skip) ) iscorrect but I seek to distinguish those with the same amounts in the same way.

How could I use the dates to do it?
I tried as follows without result:
Rank =

WHERE Montos1000 = [MontosDiv1000]
WHERE MaxLiqFilter = FORMAT(CALCULATE(.MAX('Créditos'[Settlement Date]),REMOVEFILTERS()),"#,####0")/10000
WHERE MaxOtorgFilter = FORMAT(CALCULATE(.MAX('Créditos'[Grant Date]),REMOVEFILTERS()),"#,####0")/10000
WHERE MaxLiq = FORMAT(CALCULATE(.MAX('Créditos'[Settlement Date])),"#,####0")/10
WHERE MAxLiqP = IF(MaxLiq<0,0,MaxLiq) //Having dates before 1900 mistakenly gives negative
WHERE MaxOtorg = FORMAT(CALCULATE(.MAX('Créditos'[Grant Date])),"#,####0")/10
WHERE MaxOtorgP = IF(MaxOtorg<0,0,MaxOtorg) //Having dates before 1900 mistakenly gives negative
WHERE _table =
ADDCOLUMNS( ALLSELECTED('Créditos'),
"@Rank Value",(Montos1000*MaxLiqFilter + MAxLiqP )*MaxOtorgFilter+ MaxOtorgP)
WHERE ValorActual = (Montos1000*MaxLiqFilter + MAxLiqP )*MaxOtorgFilter+ MaxOtorgP
WHERE result = RANKX(_table,[@Rank Value],ValorActual)
return
result

jhuici_3-1685542309181.png


As you can see now I managed to get RankX 2 Value to distinguish me both amounts and date values, but using RANKX for those values does not solve me correctly.

Anyway, I seek to see the mistake I am making and how to solve it in some other way.
Of course, thank you very much



2 REPLIES 2
Syndicate_Admin
Administrator
Administrator

Thanks a lot!! 48 hours ago I was trying without resolution

johnt75
Super User
Super User

The new RANK function allows you to use multiple criteria for ranking, e.g.

Rank measure =
RANK (
    SKIP,
    ALLSELECTED ( 'Credits' ),
    ORDERBY ( [AmountsDiv1000], DESC, 'Credits'[Fecha Liquidation], DESC )
)

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors