Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Slicers using Grouped Data

Hello!

 

I have a dataset based on Commodities that I would like to be able to display data based on the selected group of commodities.

 

For example - I've grouped the below items according to their market

Dairy - cheese, milk, butter, oil

Soda - sugar, aluminum

Currency - USD, Canadian Dollar, Brazilian Dollar

 

I want to be able to have a slicer that, when selected, shows me the items in that grouping only. So if I select Dairy, I want to display cheese, milk, butter, and oil data.

 

Any help would be appreciated.

  • Anonymous,

     

    Try this calculated column:

     

    Group = 
    VAR vItem = Table1[Item]
    VAR vResult =
        SWITCH (
            TRUE (),
            vItem IN { "cheese", "milk", "butter", "oil" }, "Dairy",
            vItem IN { "sugar", "aluminum" }, "Soda"
        )
    RETURN
        vResult

     

     

    Create a slicer using the Group column.

1 Reply

  • Anonymous,

     

    Try this calculated column:

     

    Group = 
    VAR vItem = Table1[Item]
    VAR vResult =
        SWITCH (
            TRUE (),
            vItem IN { "cheese", "milk", "butter", "oil" }, "Dairy",
            vItem IN { "sugar", "aluminum" }, "Soda"
        )
    RETURN
        vResult

     

     

    Create a slicer using the Group column.