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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Tduez
Regular Visitor

RANKX behabiour

Hi all,

 

I’m a bit lost in Power Bi behaviour and I’d like some help to understand et adjust my measure.

To give a bit context, a small part of my model is like this

1.pngViewing is my fact Table which contains some people looking TV

I have a dimension Network and on TOP , another Table DimTVGroupNetwork which contains Group of Newtork.

(Example:

2.png

)

If I select a Group and looking on my “classic” measure, like a sum of a field, everything looks fine.

3.png

 But I have a problem with the RANKX function.

If I create this formula: Rank = RANKX(ALLSELECTED(Network[NetworkDescription]),[Total Weight 2])

4.png

The rank is Ok, but I’ve lost my context filter, and it calculates on all the Network.

Now if I select Network separately, it’s ok.

 5.png

How can I keep my filter context, because all my relationship are bidirectional etc…

 

Thanks

Thomas

1 ACCEPTED SOLUTION
Chihiro
Solution Sage
Solution Sage

Try nesting it in IF function.

 

Rank =
IF (
    [Total Weight 2] > 0,
    RANKX ( ALLSELECTED ( Network[NetworkDescription] ), [Total Weight 2] )
)

View solution in original post

2 REPLIES 2
Tduez
Regular Visitor

Yes you're Right, Thanks

 

But still, I don't figure out why the ALLSELECTED() don't keep the Filter 

At least it works, so Thx again

 

Thomas

 

Chihiro
Solution Sage
Solution Sage

Try nesting it in IF function.

 

Rank =
IF (
    [Total Weight 2] > 0,
    RANKX ( ALLSELECTED ( Network[NetworkDescription] ), [Total Weight 2] )
)

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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