Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Create a Slicer based on data from 3 columns

This is an expansion of my earlier query, which was resolved for 2 columns, now I would like to create a slicer based on 3 columns: https://community.fabric.microsoft.com/t5/Desktop/Create-a-Slicer-...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi Anonymous 

     

    When you select A and B, SUM('Selection Table'[Value]) returns 3 rather than 7 you'd expect, that's why it doesn't work here. You can modify the Result measure like below.  

    Result =
    SWITCH (
        SUM ( 'Selection Table'[Value] ),
        1, [Sum of TypeA],
        2, [Sum of TypeB],
        3, IF ( COUNTROWS ( 'Selection Table' ) = 1, [Sum of TypeC], [Total of TypeAB] ),
        4, [Total of TypeAC],
        5, [Total of TypeBC],
        6, [Total of Types]
    )
    

     

    Or you can try a new measure

    Result = 
        SWITCH(
            VALUE(CONCATENATEX('Selection Table','Selection Table'[Value])),
            1 , [Sum of TypeA],
            2 , [Sum of TypeB],
            3 , [Sum of TypeC],
            12, [Total of TypeAB],
            13, [Total of TypeAC],
            23, [Total of TypeBC],
            123, [Total of Types]
        )

     

    Best Regards,
    Jing
    If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!