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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register 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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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