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

Shape the future of the Fabric Community! Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions. Take survey.

Reply
Syndicate_Admin
Administrator
Administrator

Filter problem with rankx

Hello. I'm trying to rank the behavior of a number of products over time. It turns out that there are times that the RankX solves the ranking correctly but there are times that it repeats the values and I do not know why it does.

Has anyone faced this problem and could you help me?

This is the DAX of rankx

Ranking2 = RANKX(ALL('Data (2)'[REG. CORPORATION]),CALCULATE(sum('Data (2)'[MXN])),,DESC,Skip)

and this is the picture of the problem

Thanks a lot

RankX.png

4 REPLIES 4
Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your Data model looks like, but please try the below whether it suits your requirement.

 

Ranking2 =
RANKX (
    FILTER (
        SUMMARIZE (
            ALL ( 'Data (2)' ),
            'Data (2)'[REG. CORPORATION],
            'CalendarTable'[Month]
        ),
        'CalendarTable'[Month] = MAX ( 'CalendarTable'[Month] )
    ),
    CALCULATE ( SUM ( 'Data (2)'[MXN] ) ),
    ,
    DESC,
    SKIP
)

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

Thank you very much, if it works, only there is something strange that is happening with the RankX function, when I apply it to all the data it works well but when I apply a company filter the function no longer works well until I select several companies.

In the image we can see that Company 170 in the month of July has the10th position when all the companies are selected.

Ejemplo Todos.JPG

But when you select that company only, the ranking changes to 1 and is corrected back to 10 when more than one company is selected.

Compañia 170.JPGDos compañías.JPG

Hopefully you can help me find what I am doing wrong with the filters, I have been trying for hours and I can not find the problem

Thanks a lot

Hi,

Thank you for your feedback.

I am not sure how your data model looks like, but I think you can try to replace ALL in the measure with ALLSELECTED whether it suits your requirement.

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

Hello. The Allselect does not help solve the problem.

Add the link with my data model in case you can help me check that I'm doing wrong.

Thanks a lot

https://drive.google.com/drive/folders/1Ii5y_4LY-rihNpbCqMnkN7WXOF__Kmm2?usp=sharing

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

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.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.