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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

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