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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
ddpl
Solution Sage
Solution Sage

RankX for each row in Matrix from two tables...???

I have two tables

Sale (3 rows: criteria, sold, dayDiff)

Tab2 (1 row: day: containing '3Days', '7Days', '15Days', '30Days')

No relationship between those two, obviously.

 

I want rank for each row but my 'rank' measure is not gave me right result, the measure gave same value 1 for every cell

 

measure 1 : 

value = 

var _sv = SELECTEDVALUE(Tab2[day])
return
SWITCH(
    TRUE(),
    _sv = "3 Days", CALCULATE(SUM(Sale[sold]), Sale[dayDiff] <= 3),
    _sv = "7 Days", CALCULATE(SUM(Sale[sold]), Sale[dayDiff] <= 7),
    _sv = "15 Days", CALCULATE(SUM(Sale[sold]), Sale[dayDiff] <= 15),
    _sv = "30 Days", CALCULATE(SUM(Sale[sold]), Sale[dayDiff] <= 30)
)
 
measure 2 :
rank =
IF(
    NOT(ISBLANK([value])),
    RANKX(
        CALCULATETABLE(
            ALLSELECTED(Tab2[day])
        ),
        [value],,,Dense
    )
)
 
I need a matrix like below (switch values to rows = ON)
criteria   3Days   7Days   15Days   30Days
A    
value   100   300   500   50
rank   3   2   1   4
B    
value   400   200   800   1000
rank   3   4   2   1
C    
value   70   500   450   600
rank   4   2   3   1
1 REPLY 1
TomMartens
Super User
Super User

Hey @ddpl ,

 

please prepare a pbix file containing sample data that still reflects your semantic model (tables, relationships, calculated columns, and measures). Upload the pbix to OneDrive, Google Drive, of Dropbox and share the link.

If you are using a spreadsheet to create the sample data, share the spreadsheet as well.

 

Can you please explain what you are ranking and how this does relate to the binning?

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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