Forum Discussion

Mery's avatar
Mery
Frequent Visitor
6 years ago

Top 5 percent filter

hello!

 

I am trying to show just Top 5 cp in a barchart and hide or do not show other values in the barchart.

Like that:

the problem here, i'm using this formula to calculate the percentage:

%cp = 

DIVIDE(SUM (table[volume]);CALCULATE(SUMX(filter( table; table[cp] <>"med" );table[volume] );ALL( table)))
and when i use the cp on filter, the percentage doesn't change
i rather wait for top 5 of this result:
 
Any help!
Thank you

5 Replies

  • VasTg's avatar
    VasTg
    Icon for Memorable Member rankMemorable Member

    Mery 

     

    In the new filter panel on the right side after you select the visual, select the attribute(arrow) and choose filter type as top N and 5. 

    Drag the measure you used in the graph in "By Value"(highlighted) and Apply filter.

    If it helps ,mark it as a solution

    Kudos are nice too

    • Mery's avatar
      Mery
      Frequent Visitor

      my problem isn't how to display the top 5 but how calculate the percentage correctly in mode top 5 as explained on the post. 

  • VasTg's avatar
    VasTg
    Icon for Memorable Member rankMemorable Member

    Mery 

     

    Try this..

     

     

     

    %cp = 
    VAR A = ALLSELECTED(TABLE[CP])
    VAR B = CALCULATE(SUM(TABLE[volume]),FILTER(A,TABLE[cp]<>"med")) 
    RETURN DIVIDE(SUM (table[volume]),B)

     

     

    Let us know..

     

     

    If it helps, mark it as a solution

    Kudos are nice too 

  • Hi Mery ,

     

    In your "cp%" calculation, use ALLSELECTED rather then ALL.

     

    Thanks.

    • Mery's avatar
      Mery
      Frequent Visitor

      The problem with ALLSELECTED, when i keep top 5 i have a 100% on the 5 cp.