Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago
Solved

Redundand values

Hello community, How do I aggregate all the values that are not top 10 of sum values as 'other'? Many thanks,
  • Elena_Kalina's avatar
    1 year ago

    Hi Anonymous 

    Please try this one:

     

    Product Grouping =
    VAR CurrentCategory = SELECTEDVALUE('Superstore'[Product Name])
    VAR Top10Categories =
        CALCULATETABLE(
            TOPN(
                10,
                VALUES('Superstore'[Product Name]),
                [Total_Sales],  
                DESC
            ),
            ALLSELECTED('Superstore'[Product Name])
        )
    RETURN
        IF(
            CurrentCategory IN Top10Categories,
            [Total_Sales],
            "Other"
        )
     

    If this post helps, then please consider Accepting as solution to help the other members find it more quickly, don't forget to give a "Kudos" – I’d truly appreciate it! 

    Thank you.