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
Ethanhunt123
Helper III
Helper III

Power BI slicer OR condition

Interaction between two slicers in Power BI gives me output with AND condition Example: If I selected the year 2020 and company ABC. The output would be all the data from company ABC in the year 2020. But I want the two slicers to work with OR condition. I have used this Dax Include = (MAX(Table1[Column1]) = SELECTEDVALUE(Col1[Column1])) + (MAX(Table1[Column2]) = SELECTEDVALUE(Col2[Column2])) But the problem with above Dax I have not selected anything in slicer ( ALL by default) it is showing me blank visual.

1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

Hi @Ethanhunt123,

AFAIK, power bi use 'AND' logic to link all filters. If you want to achieve 'OR' logic, please use unconnected tables fields as the source of slicers. After these, you can extract current row contents to compare with combined selection ranges to return tag. Then you can apply this measure on your visual to filter records.

Measure =
IF (
    SELECTEDVALUE ( table[Column] )
        IN UNION ( ALLSELECTED ( Col1[Column] ), ALLSELECTED ( Col2[Column] ) ),
    "Y",
    "N"
)

If above not helps, please share some dummy data with the expected result to help us clarify you scenario and test coding formula on it.

How to Get Your Question Answered Quickly 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

3 REPLIES 3
v-shex-msft
Community Support
Community Support

Hi @Ethanhunt123,

AFAIK, power bi use 'AND' logic to link all filters. If you want to achieve 'OR' logic, please use unconnected tables fields as the source of slicers. After these, you can extract current row contents to compare with combined selection ranges to return tag. Then you can apply this measure on your visual to filter records.

Measure =
IF (
    SELECTEDVALUE ( table[Column] )
        IN UNION ( ALLSELECTED ( Col1[Column] ), ALLSELECTED ( Col2[Column] ) ),
    "Y",
    "N"
)

If above not helps, please share some dummy data with the expected result to help us clarify you scenario and test coding formula on it.

How to Get Your Question Answered Quickly 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
az38
Community Champion
Community Champion

@Ethanhunt123 

not sure it will work but try

CALCULATE(MAX(Table1[Column1]), FILTER(Table1, Table1[Column1] = SELECTEDVALUE(Col1[Column1])))
 + 
CALCULATE(MAX(Table1[Column2]), FILTER(Table1, Table1[Column2] = SELECTEDVALUE(Col2[Column2]))) 

do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn
amitchandak
Super User
Super User

@Ethanhunt123 , Try like

 

calculate(countrows(Table), all(Table[company]),all(Table[year),filter(table,Table[company] =selectedvalue(Table[company]) || Table[year] =selectedvalue(Table[year])))

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.