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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Anonymous
Not applicable

Top N for subcategory

Hello,

 

I have table with product,reason and values.

For each product i need to show top 5 values(measure named #m_cases). So i have written the formula for rank and added that in filter. The values are showing right but the total values are showing for only top 5 . I need to show top5 values for each product with right values and total should for all reasons. 

     I have added the below measure, it showing the right totals but values for each reason is showing same values!

 

ALLSELECTED = CALCULATE([#m_Cases],ALL('Cases'[Reason]))

 

  • Kindly help. Thanks in Advance.

 

 

1 ACCEPTED SOLUTION
Payeras_BI
Solution Sage
Solution Sage

Hi @Anonymous ,

 

I think I understood it now.

 

Your measure =
IF (
    ISINSCOPE ( 'Cases'[Reason] ) = TRUE (),
    [#m_Cases],
    CALCULATE ( [#m_Cases], ALL ( 'Cases'[Reason] ) )
)

 

Please let me know the result.

 

If this post answered your question, please mark it as a solution to help other users find useful content.
Kudos are another nice way to acknowledge those who tried to help you.

J. Payeras
Mallorca, Spain

View solution in original post

5 REPLIES 5
Payeras_BI
Solution Sage
Solution Sage

Hi @Anonymous ,

 

I think I understood it now.

 

Your measure =
IF (
    ISINSCOPE ( 'Cases'[Reason] ) = TRUE (),
    [#m_Cases],
    CALCULATE ( [#m_Cases], ALL ( 'Cases'[Reason] ) )
)

 

Please let me know the result.

 

If this post answered your question, please mark it as a solution to help other users find useful content.
Kudos are another nice way to acknowledge those who tried to help you.

J. Payeras
Mallorca, Spain
Payeras_BI
Solution Sage
Solution Sage

Hi @Anonymous ,

 

Try substituting ALL by VALUES.

 

If this post answered your question, please mark it as a solution to help other users find useful content.
Kudos are another nice way to acknowledge those who tried to help you.

J. Payeras
Mallorca, Spain
Anonymous
Not applicable

Not working!

Hi @Anonymous ,

 

Help me to understand your expected output. From your original screenshot, which values are correct and which are incorrect?

 

If this post answered your question, please mark it as a solution to help other users find useful content.
Kudos are another nice way to acknowledge those who tried to help you.

J. Payeras
Mallorca, Spain
Anonymous
Not applicable

Here is the Matrix table where i removed the top 5 filter.

 

 Here, For Avalara account i need the top 5 subcategory (filed name - Reason) by the value (#m_cases). I need to show the top 5 values but the total should exclude the top 5 and show for all reason. I.e 16384.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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