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
Suryakala
Regular Visitor

Apply Rank to a subcategory when slicers applied

I have a fields RC category, under that Application catgeory. It should sort by Defect count. I also have a date slicer. When i select a date range, I want to have a clustered graph, which should display the RC category . Under RC category, there should be top 10 applications shown based on the defect count. I am trying to use the RANKX. But it is not working. Pls help as I am a beginner to POwer BI. I have tried multiple options but it doesnt work.

 

Rank2 = IF(ISINSCOPE(nonproditrack[Application Fixed In]),(RANKX(ALL(nonproditrack[Application Fixed In]),nonproditrack[NonProdDefectcount],,DESC,Dense)),if(ISINSCOPE(nonproditrack[RC Categorization]),RANKX(ALL(nonproditrack[RC Categorization]),nonproditrack[NonProdDefectcount],,DESC,Dense)))

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

Hi @Suryakala ,

 

Thanks DataNinja777  for the quick reply. I have some other thoughts to add:

(1) This is my test data. 

vtangjiemsft_0-1730097532425.png

(2) We can create a measure. 

Rank =
RANKX (
    ALLSELECTED ( 'nonproditrack' ),
    [NonProdDefectcount],
    MAX ( 'nonproditrack'[NonProdDefectcount] ),
    DESC
)

(3) Place [rank<=10] on the visual object's filter and then the result is as follows.

vtangjiemsft_1-1730097629880.png

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

 

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

View solution in original post

3 REPLIES 3
v-tangjie-msft
Community Support
Community Support

Hi @Suryakala ,

 

Thanks DataNinja777  for the quick reply. I have some other thoughts to add:

(1) This is my test data. 

vtangjiemsft_0-1730097532425.png

(2) We can create a measure. 

Rank =
RANKX (
    ALLSELECTED ( 'nonproditrack' ),
    [NonProdDefectcount],
    MAX ( 'nonproditrack'[NonProdDefectcount] ),
    DESC
)

(3) Place [rank<=10] on the visual object's filter and then the result is as follows.

vtangjiemsft_1-1730097629880.png

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.

 

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

DataNinja777
Super User
Super User

Hi @Suryakala ,

 

To achieve your desired result—showing RC categories with top 10 applications under each category based on Defect Count, while dynamically adjusting to the selected date range—we can optimize your approach using RANKX. Below is a working solution.

Rank_Application = 
VAR CurrentApplication = SELECTEDVALUE(nonproditrack[Application Fixed In])
RETURN
IF (
    ISINSCOPE(nonproditrack[Application Fixed In]),
    RANKX(
        FILTER(
            ALL(nonproditrack[Application Fixed In], nonproditrack[RC Categorization]),
            nonproditrack[RC Categorization] = SELECTEDVALUE(nonproditrack[RC Categorization])
        ),
        CALCULATE(SUM(nonproditrack[NonProdDefectcount])),
        ,
        DESC,
        DENSE
    )
)

Best regards,

@DataNinja777 @v-tangjie-msft Thank you Guys for your quick reply! Sorry for my delayed response.

 

I would like to explain my query in detail.

 

@v-tangjie-msft 

1. Slicer is only on the date. 

2. In th graph, i want to display both the categories.

3. I want to sort the the sub category alone based on the defectcount under each category.

4. Catgeory should appear only once. (When i try to sort by sub actegory, multiple categories are being created)

Below is sample graph from PPT,

Suryakala_0-1730968230048.pngSuryakala_1-1730968262926.png

In PowerBI, i am not able to categorize the apps based on defect count. Pls help as I have been struggling to achieve this sort within subcategory when category is also present in graph.

 

Suryakala_2-1730968418774.png

 

 

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.