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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Luodada
Helper I
Helper I

Rankx the measure caculated through the BOM

Hello Everyone 

 

I am new at Power BI , and I have problem here in getting the correct Rankx

appreciate if anyone could help me out .

 

 

I have three tables 

1, Statistics Table

productperiodvolume
AppleJan320
AppleFeb650
OrangeJan110
OrangeFeb890
PearJan300
PearFeb400
BananaJan550
BananaFeb300
2000Jan400
2000Feb900

2, BridgeTable

Product
apple
orange
pear
banana
2000

3,BOM table

componentproductqty
1001apple1
1002apple2
1003apple3
1001orange1
1003orange6
1001pear1
1002pear8
1003banana2
1002banana4
200020001

the Measure I used RANKX(Statistics;[Component Volume];;ASC) , but the result is not correct as below picture , Capture.PNGCapture2.PNGany clue ?? thanks 

 

 

 

 

 
2 ACCEPTED SOLUTIONS

@Luodada

 

Try this one

 

rank =
RANKX ( ALLSELECTED ( Bridgetable[product] ), [Component Volume],, ASC, DENSE )

Regards
Zubair

Please try my custom visuals

View solution in original post

@Luodada

 

If you donot want to rank the BLANKS..then

 

rank2 =
VAR myrank =
    RANKX (
        FILTER ( ALLSELECTED ( Bridgetable[product] ), [Component Volume] <> BLANK () ),
        [Component Volume],
        ,
        ASC,
        DENSE
    )
RETURN
    IF ( NOT ( ISBLANK ( [Component Volume] ) ), myrank )

Regards
Zubair

Please try my custom visuals

View solution in original post

10 REPLIES 10
Zubair_Muhammad
Community Champion
Community Champion

@Luodada

 

May be

 

=
RANKX ( ALLSELECTED ( Statistics[product] ), [Component Volume],, ASC )

Regards
Zubair

Please try my custom visuals

@Zubair_Muhammad

 

Thanks Zubair , but it does not work 

do you know what else might fix it Capture.PNG

 

 

@Luodada

 

Could you share your file via onedrive or googledrive?


Regards
Zubair

Please try my custom visuals

@Luodada

 

Please See file attached

 

ranking.png

 

 


Regards
Zubair

Please try my custom visuals

@Zubair_Muhammad

 

what if I would like to remove the blank and 0 value from the ranking result ?

 

 

 

@Zubair_Muhammad

Bingo !

thanks so much!! @Zubair_Muhammad

 

you are wondeful!

 

 

 

@Luodada

 

Try this one

 

rank =
RANKX ( ALLSELECTED ( Bridgetable[product] ), [Component Volume],, ASC, DENSE )

Regards
Zubair

Please try my custom visuals

@Luodada

 

If you donot want to rank the BLANKS..then

 

rank2 =
VAR myrank =
    RANKX (
        FILTER ( ALLSELECTED ( Bridgetable[product] ), [Component Volume] <> BLANK () ),
        [Component Volume],
        ,
        ASC,
        DENSE
    )
RETURN
    IF ( NOT ( ISBLANK ( [Component Volume] ) ), myrank )

Regards
Zubair

Please try my custom visuals

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.