Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

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

MaWrob_0-1726646151614.png

 

1 ACCEPTED SOLUTION
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.

vyaningymsft_0-1727160841486.pngvyaningymsft_1-1727160853410.pngvyaningymsft_2-1727160866242.pngvyaningymsft_3-1727160882051.png


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

View solution in original post

6 REPLIES 6
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.

vyaningymsft_0-1727160841486.pngvyaningymsft_1-1727160853410.pngvyaningymsft_2-1727160866242.pngvyaningymsft_3-1727160882051.png


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

Selva-Salimi
Super User
Super User

Hi @Anonymous 

 

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

SelvaSalimi_0-1726648406205.png 

SelvaSalimi_1-1726648481225.png

 

 

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
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"

MaWrob_0-1726649273409.png

 

@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?!

Anonymous
Not applicable

Hello @Selva-Salimi , thanks for that.

I have a similar slicer in mind like the one below: so I pick which channel / team to filter and get turnover and other metrics like in a table filtered for that team.

The problem I have is that channels / teams come from separate columns (like in screenshot earlier) and I don't know how to make them into a structure below

MaWrob_0-1726652790732.png

 

@Anonymous 

 

I think you need which contains your column names and an ID to simply manage as follows: (named team_table)

1Team_Blogger
2Team_CC
3Team_email
......

 

and use this table in your slicer. this table should not have any relationship with others. then write a measure as follows:

measure related_Ids := var selected_team= values( team_table [ID])

return

if({1} in selceted_team , if ( your_table [from_blogger] = Blank() , 0 , 1) , if {2} in selected_team , if ( your_table [from_cc] = blank() , 0,1) ,......)

 

and add this measure to visual level filter and set it to 1.

SelvaSalimi_0-1726655641666.png

 

 

 
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. 

  

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.