Forum Discussion

Tduez's avatar
Tduez
Regular Visitor
9 years ago
Solved

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

Viewing 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:

)

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

 But I have a problem with the RANKX function.

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

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.

 

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

 

Thanks

Thomas

  • Try nesting it in IF function.

     

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

2 Replies

  • Chihiro's avatar
    Chihiro
    Icon for Solution Sage rankSolution Sage

    Try nesting it in IF function.

     

    Rank =
    IF (
        [Total Weight 2] > 0,
        RANKX ( ALLSELECTED ( Network[NetworkDescription] ), [Total Weight 2] )
    )
  • Tduez's avatar
    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