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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch 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 )

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
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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.