cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
zfemmer
Helper I
Helper I

Slicer - Filter By 1 of 3 columns

I am trying to be able to give the end-user the ability to filter by 1 of 3 columns, but not any more than that. The columns are MarketSegment, Source, and SourceSummary.

 

I have the following dataset; just a small sample:

DateStatusMarketSegmentSourceSourceSummaryBookedRevenue
09/10/20ConsumedOnline Travel AgentsOnline Travel AgentsOnline Travel Agent759.94
03/22/19ConsumedNational CorporateDirect ReservationNCC313.47
06/28/19ConsumedOnline Travel AgentsOnline Travel AgentsOnline Travel Agent1871.29
10/30/19CancelledDiscount/PromoNational Call CenterNCC151.99
04/15/19CancelledDiscount/PromoDirect ReservationNCC90.24
09/12/19ConsumedDiscount/PromoDirect ReservationNCC582.51
08/10/19ConsumedOnline Travel AgentsOnline Travel AgentsOnline Travel Agent1713.37
10/07/20ConsumedRetailDirect ReservationNCC579.96
05/04/20ConsumedOnline Travel AgentsOnline Travel AgentsOnline Travel Agent94.99
01/24/19ConsumedLocal CorporateDirect ReservationNCC94.99
04/15/19CancelledDiscount/PromoDirect ReservationNCC179.38
07/25/19ConsumedLocal CorporateNational Call CenterNCC380
10/09/19ConsumedOnline Travel AgentsGlobal Dist. SystemGDS787.95

I would like the end-user to be able to select which column they want to filter by:

zfemmer_0-1603465753003.png

Then potentially this would filter another slicer to show those values:

zfemmer_1-1603465825821.png

I have tried a few different data models and I cannot figure out a way to do this.

 

Anyone have any ideas?

 

2 REPLIES 2
wdx223_Daniel
Super User
Super User

@zfemmer using Power Qurey, you can create a table to combine three columns like this

wdx223_Daniel_0-1603696864140.png

then add Category and Content to two slicers respectively, and use the measure like this

TTL = CALCULATE(SUM(SampleTable[BookedRevenue]),FILTER(SampleTable,SampleTable[MarketSegment] IN VALUES(SlicerTable[Content])||SampleTable[Source] IN VALUES(SlicerTable[Content])||SampleTable[SourceSummary] IN VALUES(SlicerTable[Content])))

finally, the result as below

wdx223_Daniel_1-1603697041091.png

 

themistoklis
Super User
Super User

@zfemmer 

 

This thread will help you.

https://community.powerbi.com/t5/Desktop/Fieldnames-in-slicer-for-1-chart/m-p/1419019#M599357

 

Create a field in a reference table that will have the values 'Market Segment', 'Source' and 'Source Summary'.

 

Add the field above in chiclet slicer visual (if you want). The buttons are shown as in your image

https://appsource.microsoft.com/en-us/product/power-bi-visuals/WA104380756?tab=Overview

 

Then create the measure

 

My variabele col =

VAR Selection =
    SELECTEDVALUE ( 'Ref table'[Variable] )
RETURN

    SWITCH (

        Selection,
        "Market Segment", MAX ( 'Maintable'[Market] ),
        "Source", MAX ( 'Maintable'[Source] ),
        "Source Summary", MAX ( 'Maintable'[SourceSummary] )

    )

Helpful resources

Announcements
November 2022 Update

Check it Out!

Click here to read more about the November 2022 updates!

Power BI Dev Camp Session 27

Ted's Dev Camp

This session walks through creating a new Azure AD B2C tenant and configuring it with user flows and custom policies.

Health and Life Sciences Power BI User Group

Health and Life Sciences Power BI User Group

Power BI specialists at Microsoft have created a community user group where customers in the provider, payor, pharma, health solutions, and life science industries can collaborate.