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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

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 )

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 )

View solution in original post

10 REPLIES 10
Zubair_Muhammad
Community Champion
Community Champion

@Luodada

 

May be

 

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

@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?

@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 )

@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 )

Helpful resources

Announcements
Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan NL Carousel

Fabric Community Update - January 2025

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