cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Ilias69
Regular Visitor

Ranking in matrix doesn't work with filter

Hello everyone ! 


I'm trying to rank my total weight per client (name 1 in the matrix).

To do this, I used this formula which gives me a correct ranking :

 

Ranking  =
VAR Customers =
ALLSELECTED(ZV048[Name 1])
VAR Result =
CALCULATE(
RANKX(Customers, ZV048[Total weight formula],, DESC, DENSE ),
REMOVEFILTERS( ZV048 ),
VALUES('Calendar'[Date].[Année]),
VALUES(ZV048[Name 1]),
ALLSELECTED(ZV048[Shipping type])
)

RETURN
Result

 

Ilias69_4-1647526941952.png

 

 

However, when I use my Shipping type filter, the ranking does not act intelligently : 

 

Ilias69_3-1647526820301.png

 

Indeed, by choosing a shipping type filter I would like to have a ranking starting from 1.

 

Any idea? 

 

Thank you.

 

Regards,

 

Ilias

1 ACCEPTED SOLUTION
v-jayw-msft
Community Support
Community Support

Hi @Ilias69 ,

 

Please check this formula.

Ranking =
CALCULATE (
    RANKX (
        FILTER (
            ALLSELECTED ( ZV048 ),
            ZV048[Name 1] = SELECTEDVALUE ( ZV048[Name 1] )
        ),
        ZV048[Total weight formula],
        ,
        DESC,
        DENSE
    ),
    ALLSELECTED ( 'Calendar'[Date].[Année] )
)

If it doesn't work, please share the pbix to us so that we could test formula.

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

View solution in original post

3 REPLIES 3
v-jayw-msft
Community Support
Community Support

Hi @Ilias69 ,

 

Please check this formula.

Ranking =
CALCULATE (
    RANKX (
        FILTER (
            ALLSELECTED ( ZV048 ),
            ZV048[Name 1] = SELECTEDVALUE ( ZV048[Name 1] )
        ),
        ZV048[Total weight formula],
        ,
        DESC,
        DENSE
    ),
    ALLSELECTED ( 'Calendar'[Date].[Année] )
)

If it doesn't work, please share the pbix to us so that we could test formula.

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
amitchandak
Super User
Super User

@Ilias69 , Try

RANKX(Summarize(allselected(ZV048), ZV048[Name 1],'Calendar'[Date],ZV048[Shipping type] ), ZV048[Total weight formula],, DESC, DENSE )

 

 



Power BI Features || Datamarts: https://youtu.be/8tskWsJTEpg || Field Parameters : https://youtu.be/lqF3Wa1FllE?t=70
Time Intelligence Decoded : https://youtu.be/aU2aKbnHuWs&t=145s
Did I answer your question? Mark my post as a solution! Appreciate your Kudos !! Proud to be a Super User! !!
Dashboard of My Blogs !! Connect on Linkedin !! Subscribe to my youtube Channel !!
Want To Learn Power BI | Beginners !! Advance Concepts !! Power BI For Tableau User !!

Thank you @amitchandak ,

 

Here is the result using this formula :

 

Ilias69_0-1647605391458.png

 

Various clients have the same ranking.

 

And using a shipping type filter: 

 

Ilias69_1-1647605391471.png

 

 

Maybe something wrong with my Total weight formula ?

 

Total weight formula = SUM(ZV048[Total Weight])
 
Ilias

Helpful resources

Announcements
August 1 episode 9_no_dates 768x460.jpg

The Power BI Community Show

Watch the playback when Priya Sathy and Charles Webb discuss Datamarts! Kelly also shares Power BI Community updates.

Power BI Dev Camp Session 24 without aka link and time 768x460.jpg

Ted's Dev Camp - July 28, 2022

Watch Session 24 of Ted's Dev Camp along with past sessions!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Top Solution Authors
Top Kudoed Authors