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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
shuhn1229
Helper III
Helper III

Exclude Certain Values From Slicer analysis

Hi all,

 

I am wondering the best way to go about this. I have a table like the below

IDQuantAQuantB
14 
251
331

 

I am trying to setup a slicer that will let users slice out all values less than what is specified based on QuantA column. Meaning If "5" was supplied ID 1 would be filtered out. However, I want the slicer to INCLUDE all values where QuantB has a number, regardless is quantA is under the threshold supplied. What would be the best way to go about this?

 

Thanks

2 REPLIES 2
Alef_Ricardo_
Resolver II
Resolver II

You can achieve this by creating a new calculated column in your data table that will be used to drive the slicer. This column will check the conditions you specified and return a value accordingly. Here's how you can do it:

1. Go to the `Modeling` tab in Power BI and click on `New Column`.
2. Enter the following DAX formula for the new column:

```DAX
IncludeInSlicer =
IF(
[QuantA] >= "5" || NOT(ISBLANK([QuantB])),
"Include",
"Exclude"
)
```

This formula checks if `QuantA` is greater than or equal to 5 or if `QuantB` is not blank, and returns "Include" if true, otherwise it returns "Exclude".

3. Now, create a slicer based on this new `IncludeInSlicer` column. This slicer will have two values: "Include" and "Exclude". When you select "Include", it will filter the data as per your requirements.

Please note that you need to replace `"5"` with the actual threshold value you want to use.

I hope this helps! Let me know if you have any other questions.

Origem: conversa com o Bing, 12/10/2023
(1) Using field parameters and calculation groups for conditional .... https://www.sqlbi.com/articles/using-field-parameters-and-calculation-groups-for-conditional-formatt....
(2) IF and SELECTEDVALUE with multiple conditions. https://community.fabric.microsoft.com/t5/Desktop/IF-and-SELECTEDVALUE-with-multiple-conditions/m-p/....
(3) powerbi - Power BI slicer OR condition - Stack Overflow. https://stackoverflow.com/questions/63241081/power-bi-slicer-or-condition.
(4) Slicer with AND condition in Power BI - RADACAD. https://radacad.com/slicer-with-and-condition-in-power-bi.
(5) Using OR conditions between slicers in DAX - SQLBI. https://www.sqlbi.com/articles/using-or-conditions-between-slicers-in-dax/.

Hi,

 

Thank you so much, the problem is I want "5" to be dynamically supplied by the slicer control, not hard coded.

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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