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
DJSwezey
Helper I
Helper I

Filter Measure based on Text Value in Measure

I have a profit and margin table where the margin is a measure. I want to create a slicere where I can select 1 of 2 options: "Positive Margin" or "Negative Margin" where positive margin returns all Quarters where Margins that are greater than 0 and Negative Margin returns all quarters where margins are less than 0. 

 

DJSwezey_1-1698759816075.png

 

1 ACCEPTED SOLUTION
speedramps
Super User
Super User

Click here to download solution 

 

How is works ...
Create a option pick list table and add a single selection slicer

speedramps_0-1698761300929.png

 

Create a measure that returns 1 when the output matches the slicer option

 

IsOption = 
VAR selectedoption = SELECTEDVALUE('Option picklist'[Option])
RETURN
SWITCH(TRUE(),
    selectedoption = "All Margins",1,
    selectedoption = "Positive Margins" && [Margin%] >= 0,1,
    selectedoption = "Negative Margins" && [Margin%] < 0,1
)

 

 

Add a filter must = 1 to your repport visual

speedramps_1-1698761496335.png

Remember we are unpaid volunteers. So please click the thumbs up and the [accept as solution] button to leave kudos. 

One question per ticket please. If you need to extend your request then please raise a new ticket.

You will get a quicker response and each volunteer solver will get the kudos they deserve. Thank you ! 

If you quote @speedramps in your next tickets then I will then receive an automatic notification, and will be delighted to help you again.

Please now click the thumbs up and the [accept as solution] button.  Thnak you.

 

View solution in original post

4 REPLIES 4
speedramps
Super User
Super User

One question per ticket please!

 

If you need to extend your request then please raise a new ticket.

You will get a quicker response and each volunteer solver will get the kudos they deserve. Thank you ! 

If you quote @speedramps in your next tickets then I will then receive an automatic notification, and will be delighted to help you again.

Please now click the thumbs up and the [accept as solution] button.  Thank you.

mussaenda
Super User
Super User

Hi @DJSwezey ,

 

You can create a separate tab;e with no any relationship with the categories you want to show in slicer and create a measure with switch function or if else with the logic that you explained above.

 

speedramps
Super User
Super User

Click here to download solution 

 

How is works ...
Create a option pick list table and add a single selection slicer

speedramps_0-1698761300929.png

 

Create a measure that returns 1 when the output matches the slicer option

 

IsOption = 
VAR selectedoption = SELECTEDVALUE('Option picklist'[Option])
RETURN
SWITCH(TRUE(),
    selectedoption = "All Margins",1,
    selectedoption = "Positive Margins" && [Margin%] >= 0,1,
    selectedoption = "Negative Margins" && [Margin%] < 0,1
)

 

 

Add a filter must = 1 to your repport visual

speedramps_1-1698761496335.png

Remember we are unpaid volunteers. So please click the thumbs up and the [accept as solution] button to leave kudos. 

One question per ticket please. If you need to extend your request then please raise a new ticket.

You will get a quicker response and each volunteer solver will get the kudos they deserve. Thank you ! 

If you quote @speedramps in your next tickets then I will then receive an automatic notification, and will be delighted to help you again.

Please now click the thumbs up and the [accept as solution] button.  Thnak you.

 

Perfect! This worked on the most granular level of my table, but not sure it works if I drill up.

You can drill down quarter into state and then into city.

DJSwezey_0-1698782610973.png

When I filter by "Positive" or 'negative" at this level things work great.

If I drill up then it looks like the filter doesnt work 

DJSwezey_1-1698782679408.png

 

 

 

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.