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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Slicer / Filter exception

Hi guys, I'm new in PBI, I'm looking for ways to have a condition in filter. I have these slicers with type: sedan, hatchback, truck and I have 2 line chart:
- Hatchback and Sedan
- Truck

Daniel_Pel_0-1637132103771.png

Now, I have the table car type as global filter:

Daniel_Pel_3-1637132243801.png

They have relationship on car type hence when I select any value in the slicer, it will affect the line charts. Now my goal is that if I only select Truck, the hatchback and sedan linechart should not be affected:

Daniel_Pel_5-1637132620612.png

and if I select Sedan and Truck, both the line chart should be affected:

Daniel_Pel_6-1637132656387.png


This is the sample data:
Car type:

CarType
Truck
Sedan
Hatchback


hatchback and Sedan:

TypeIdExtractedDate_YearMonthSumDuration
SedanORDER1233501/10/202180.1
SedanORDER5672301/01/202181
SedanORDER7523101/11/202122
HatchbackORDER1684301/08/202113

 

Truck:

TypeIdExtractedDate_YearMonthSumDuration
TruckORDER1111101/01/202112.1
TruckORDER3333301/02/202199
TruckORDER3333101/03/202117


I have other linecharts connected to the car type and I want to just use this car type as global filter. Do you guys have an tips or tricks for me to utilize the slicer?

Thanks in advance!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi  @Anonymous ,

You can create two measures separately. When the slicer selects Truck, the display related to Truck is displayed. When the slicer selects Truck and Sedan, the display related to Truck and Sedan is displayed. I don't know what the result of your specific condition judgment is. To define the rules, you can replace the judgment result in the following function:

Measure =
var _select=SELECTCOLUMNS('Car type',"1",'Car type'[CarType])
return
IF(
    "Truck" in _select&& NOT("Sedan" in _select),
    SUM('hatchback and Sedan'[SumDuration]),0
    )
Measure 2 =
var _select=SELECTCOLUMNS('Car type',"1",'Car type'[CarType])
return
IF(
    "Truck" in _select&& "Sedan" in _select,
    SUM('Truck'[SumDuration]),0
    )

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi  @Anonymous ,

You can create two measures separately. When the slicer selects Truck, the display related to Truck is displayed. When the slicer selects Truck and Sedan, the display related to Truck and Sedan is displayed. I don't know what the result of your specific condition judgment is. To define the rules, you can replace the judgment result in the following function:

Measure =
var _select=SELECTCOLUMNS('Car type',"1",'Car type'[CarType])
return
IF(
    "Truck" in _select&& NOT("Sedan" in _select),
    SUM('hatchback and Sedan'[SumDuration]),0
    )
Measure 2 =
var _select=SELECTCOLUMNS('Car type',"1",'Car type'[CarType])
return
IF(
    "Truck" in _select&& "Sedan" in _select,
    SUM('Truck'[SumDuration]),0
    )

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Thank you

Greg_Deckler
Community Champion
Community Champion

@Anonymous Sorry, having trouble following, can you post sample data as text and expected output?
Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882

Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Hi @Greg_Deckler , I've updated the question, thanks for the info!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.