Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Help with TOP N Charts

Is there a way to have a Top N chart showing the top categories and then have 2 top n categories under showing the top subcategories for the two 2 categories showing in the top chart?  We have a slicer on this page and the categories and subcategories will change depending on the selections made within the slicer.  The below is an example of what I am needing, but the two subcategory charts are showing the same data...  how can I make them show the correct subcategories for the top categories in the top chart.  

  • Hi Anonymous ,

     

    Suppose you have the following data. 

     

     

    Then for the category ranked 1 (FIN-Epro), use the [Sales] filter for the top 1 category to display the corresponding subcategories.

     

     

    Then for the category ranked 2 (FIN-ENCORE), use the measure [Rank] filter for the top 1 category to display the corresponding subcategories. 

     

    Rank = 
    VAR tab =
        SUMMARIZE (
            ALLSELECTED ( 'Table' ),
            'Table'[Categories],
            "s", SUM ( 'Table'[Sales] )
        )
    VAR RankCategory =
        COUNTROWS ( FILTER ( tab, [s] >= SUM ( 'Table'[Sales] ) ) )
    RETURN
        IF ( RankCategory = 2, 1 )

    If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
    Best Regards,
    Winniz
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

2 Replies

  • v-kkf-msft's avatar
    v-kkf-msft
    Icon for Community Support rankCommunity Support

    Hi Anonymous ,

     

    Suppose you have the following data. 

     

     

    Then for the category ranked 1 (FIN-Epro), use the [Sales] filter for the top 1 category to display the corresponding subcategories.

     

     

    Then for the category ranked 2 (FIN-ENCORE), use the measure [Rank] filter for the top 1 category to display the corresponding subcategories. 

     

    Rank = 
    VAR tab =
        SUMMARIZE (
            ALLSELECTED ( 'Table' ),
            'Table'[Categories],
            "s", SUM ( 'Table'[Sales] )
        )
    VAR RankCategory =
        COUNTROWS ( FILTER ( tab, [s] >= SUM ( 'Table'[Sales] ) ) )
    RETURN
        IF ( RankCategory = 2, 1 )

    If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.
    Best Regards,
    Winniz
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.