Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago
Solved

Slicer based on several columns

I have a base data looking like the following: (been unpivoted).

Order may come from several sources, shown, but I want to be able to select which channel I need and see orders for that channel.

How can I do this?

In the case following, I see something like a slicer, where i select adwords, or cc and see orders for that channel

 

  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi, Anonymous 

    Thanks for Selva-Salimi's suggestion. You can use Filed Parameter to generate the Slicer and then create the flag measure.


    Measure:

    flag =
    VAR _selectedSlicer =
        SELECTEDVALUE ( Parameter[Parameter Fields] )
    VAR _switchSelectedSlicer =
        SWITCH (
            _selectedSlicer,
            "'Table'[from_adwords]", "adwords",
            "'Table'[from_blogger]", "blogger",
            "'Table'[from_cc]", "cc",
            "'Table'[from_mail]", "email",
            "'Table'[from_organic]", "organic",
            "'Table'[from_social]", "social",
            BLANK ()
        )
    VAR _current_from_adwords =
        SELECTEDVALUE ( 'Table'[from_adwords] )
    VAR _current_from_blogger =
        SELECTEDVALUE ( 'Table'[from_blogger] )
    VAR _current_from_cc =
        SELECTEDVALUE ( 'Table'[from_cc] )
    VAR _current_from_mail =
        SELECTEDVALUE ( 'Table'[from_mail] )
    VAR _current_from_organic =
        SELECTEDVALUE ( 'Table'[from_organic] )
    VAR _current_from_social =
        SELECTEDVALUE ( 'Table'[from_social] )
    VAR _result =
        SWITCH (
            TRUE (),
            _switchSelectedSlicer = _current_from_adwords, 1,
            _switchSelectedSlicer = _current_from_blogger, 1,
            _switchSelectedSlicer = _current_from_cc, 1,
            _switchSelectedSlicer = _current_from_mail, 1,
            _switchSelectedSlicer = _current_from_organic, 1,
            _switchSelectedSlicer = _current_from_social, 1,
            BLANK ()
        )
    RETURN
        _result

     

    Best Regards,
    Yang

    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
    If I misunderstand your needs or you still have problems on it, please feel free to let us know.
    Thanks a lot!

    How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

6 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi, Anonymous 

    Thanks for Selva-Salimi's suggestion. You can use Filed Parameter to generate the Slicer and then create the flag measure.


    Measure:

    flag =
    VAR _selectedSlicer =
        SELECTEDVALUE ( Parameter[Parameter Fields] )
    VAR _switchSelectedSlicer =
        SWITCH (
            _selectedSlicer,
            "'Table'[from_adwords]", "adwords",
            "'Table'[from_blogger]", "blogger",
            "'Table'[from_cc]", "cc",
            "'Table'[from_mail]", "email",
            "'Table'[from_organic]", "organic",
            "'Table'[from_social]", "social",
            BLANK ()
        )
    VAR _current_from_adwords =
        SELECTEDVALUE ( 'Table'[from_adwords] )
    VAR _current_from_blogger =
        SELECTEDVALUE ( 'Table'[from_blogger] )
    VAR _current_from_cc =
        SELECTEDVALUE ( 'Table'[from_cc] )
    VAR _current_from_mail =
        SELECTEDVALUE ( 'Table'[from_mail] )
    VAR _current_from_organic =
        SELECTEDVALUE ( 'Table'[from_organic] )
    VAR _current_from_social =
        SELECTEDVALUE ( 'Table'[from_social] )
    VAR _result =
        SWITCH (
            TRUE (),
            _switchSelectedSlicer = _current_from_adwords, 1,
            _switchSelectedSlicer = _current_from_blogger, 1,
            _switchSelectedSlicer = _current_from_cc, 1,
            _switchSelectedSlicer = _current_from_mail, 1,
            _switchSelectedSlicer = _current_from_organic, 1,
            _switchSelectedSlicer = _current_from_social, 1,
            BLANK ()
        )
    RETURN
        _result

     

    Best Regards,
    Yang

    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
    If I misunderstand your needs or you still have problems on it, please feel free to let us know.
    Thanks a lot!

    How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

  • Hi Anonymous 

     

    you can add your expected columns under each other to have a hierarchy slicer. Like following:

     

     

     

    If this post helps, then I would appreciate a thumbs up  and mark it as the solution to help the other members find it more quickly.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hello Selva-Salimi thank you for the help, but this suggestion lost me. When I do a hierarchy slicers it looks like that:

      And I just want a tile "adwords" "cc", "mail"

       

      • Selva-Salimi's avatar
        Selva-Salimi
        Icon for Solution Sage rankSolution Sage

        Anonymous 

         

        I think there was a misunderstanding. would you please share an example of your expectation?! I am not sure but I think you might have a unique order number for each edward, bloger, cc, mail,... and would like to show them in slicer and as you select in the drop down can see order number?! if so, would you unpivot your table?!