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.
Hi all,
I am wondering the best way to go about this. I have a table like the below
ID | QuantA | QuantB |
1 | 4 | |
2 | 5 | 1 |
3 | 3 | 1 |
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
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.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
101 | |
99 | |
76 | |
67 | |
61 |
User | Count |
---|---|
142 | |
106 | |
103 | |
85 | |
70 |