The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
I want to be able to filter my visuals based on whether any of my multiple slicers are active.
I have been able to display data fitting any of the values in my slicers (rather than all of them) using this guide: https://apexinsights.net/blog/or-xor-slicing -- I just rewrote the OR filter to include multiple conditions:
OR Filter =
IF (
SELECTEDVALUE ( 'Table1'[Col1] ) IN ALLSELECTED ( xCol1[Col1] ) ||
SELECTEDVALUE ( 'Table2'[Col2] ) IN ALLSELECTED ( xCol2[Col2] ) ||
SELECTEDVALUE ( 'Table1'[Col3] ) IN ALLSELECTED ( xCol3[Col3] ),
1,
0
)
My problem is that I want to be able to have fewer than three slicers active and for the data to still be filtered. At the moment, if only two of the slicers are active, it still brings in everything. The data is only filtered if all three slicers are active.
Can anyone help?
Solved! Go to Solution.
Hi @travelsandbooks
To achieve the desired behavior where your visuals filter based on any of the slicers being active, not requiring all slicers to be active simultaneously, maybe you can try modify your DAX like bellow.
OR Filter =
IF (
(
ISFILTERED(xCol1[Col1]) &&
SELECTEDVALUE('Table1'[Col1]) IN VALUES(xCol1[Col1])
) ||
(
ISFILTERED(xCol2[Col2]) &&
SELECTEDVALUE('Table2'[Col2]) IN VALUES(xCol2[Col2])
) ||
(
ISFILTERED(xCol3[Col3]) &&
SELECTEDVALUE('Table1'[Col3]) IN VALUES(xCol3[Col3])
),
1,
0
)
Let me know if that helps.
Regards,
Marcel Magalhães
Microsoft Power BI Official Partner
MCT | Certified PL-300 Power BI
I'm trying to do this, but when I try and do it, the filter is greyed out when I try and apply it to the visual. How do I resolve that? Thank you!
Hi @travelsandbooks
To achieve the desired behavior where your visuals filter based on any of the slicers being active, not requiring all slicers to be active simultaneously, maybe you can try modify your DAX like bellow.
OR Filter =
IF (
(
ISFILTERED(xCol1[Col1]) &&
SELECTEDVALUE('Table1'[Col1]) IN VALUES(xCol1[Col1])
) ||
(
ISFILTERED(xCol2[Col2]) &&
SELECTEDVALUE('Table2'[Col2]) IN VALUES(xCol2[Col2])
) ||
(
ISFILTERED(xCol3[Col3]) &&
SELECTEDVALUE('Table1'[Col3]) IN VALUES(xCol3[Col3])
),
1,
0
)
Let me know if that helps.
Regards,
Marcel Magalhães
Microsoft Power BI Official Partner
MCT | Certified PL-300 Power BI