Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago
Solved

Need Slicer For Top and Bottom in Decomposition Tree

Hi,   Is it possible to get a slicer to show the top and bottom 8 of the classification by clicking a drop down with 2 options cost and revenue?   I created a  measure using SumX to arrive at the...
  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi  Anonymous ,

    I created some data:

    Here are the steps you can follow:

    1. Create measure.

    You can change the 2 to 8 in the dax formula to suit your needs.

    Flag=
    var _table1=SUMMARIZE(ALLSELECTED('Table'),[Group],"Sum_Value",SUMX(FILTER(ALLSELECTED('Table'),'Table'[Group]=MAX('Table'[Group])),[Value]))
    var _table2=ADDCOLUMNS(_table1,"Rankx_asc",RANKX(_table1,[Sum_Value],,ASC,Dense),"Rankx_desc",RANKX(_table1,[Sum_Value],,DESC,Dense))
    var _table3=FILTER(_table2,[Rankx_asc]<=2||[Rankx_desc]<=2)
    RETURN
    IF(
       MAX('Table'[Group]) in SELECTCOLUMNS(_table3,"rank_group",[Group]),1,0)

    2. Place [Flag]in Filters, set is=1, apply filter.

    3. Result:

     

     

    Best Regards,

    Liu Yang

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