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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
TheScrub
New Member

Measure with AND + OR filter of a measure

Number of open tasks with special filter =

CALCULATE('Key figures task'[number of open tasks],OR(CONTAINSSTRING('task'[task name],"Inbox*Input"),CONTAINSSTRING('task'[task name],"Inbox*Output")))

 

Hello, I have a PBI file with a direct query connection to a cube and therefore no tables. There are already some measures. Now I have created this measure (see above) because the PBI standard filtering only ever allows exclusively AND or exclusively OR operators. But here I want to say, filter contains "Inbox" "..." "Input" as AND

 

OR

 

contains "Inbox" "..." "Output" as AND. So a mixture of AND & OR.

 

The overall output in the slicer is also correct. But a drill-through must also be granted, which then displays a table as a visual and here the rows have not been filtered as desired, but rather show all tasks bluntly. So only the Silcer output is correct. Example: After this filtering there should be 24 tasks. The slicer also displays these 24 correctly. In a drill-trhough you see 270 tasks.

 

What do I have to do to make this work properly? Thanks!

2 REPLIES 2
Anonymous
Not applicable

Hi, @TheScrub 

You should use the Filter function or other related logic functions to combine the AND and OR conditions. Since I don't have your example data, the following DAX expression is just an idea for me:

Number of open tasks with special filter =

CALCULATE(

    [Key figures task[number of open tasks]],

    FILTER(

        ALL(task),

        (CONTAINSSTRING(task[name], "Inbox*Input") && CONTAINSSTRING(task[task name], "Inbox*Output"))

        ||

        (CONTAINSSTRING(task[name], "Inbox") && CONTAINSSTRING(task[task name], "Output"))

    )

)

 

 

How to Get Your Question Answered Quickly 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data)

Best Regards

Yongkang Hua

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

lbendlin
Super User
Super User

"inbox and output or inbox and input"  can be simplified as " inbox and either input or output ".

 

DAX does not have a concept of wildcards ( "*" ) but that isn't really necessary here unless you insist on the order of appearance.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors