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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

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
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors