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
Anonymous
Not applicable

Posting this to correct topic (DAX CALCULATION CREATE A COMPLEX FILTER THAT HAS many AND'S / OR'S

I need to write a calcuate (sum) using this filter.

 

I have tried to figure out a way to do this is DAX filter but it doesn't like parenthesis in the filter.

Any ideas would be very appreciated.

 

(Filter A = "b" or Filter B = "b") and Filter C = "x" and (filter D = "1" or filter D ="2")

2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

Hello,

Thanks for the reply but it will not allow me to do what you advised. Below is the image of the error I get.

 

thorton_0-1652794872243.png

 

View solution in original post

Anonymous
Not applicable

Hi @Anonymous ,

 

Try this measure.

Measure = 
CALCULATE(
    DISTINCTCOUNT('Main'[ID]),
    FILTER('Main',
        ('Main'[ADMITSTATUS]="N"||'Main'[ETHNICITY]="N")
        &&'Main'[CITIZEN]="Y"
    )
)

If this doesn't work for you, would you mind sharing a sample data without privacy and tell me what data you want to filter out? Thanks in advance.

 

How to provide sample data in the Power BI Forum

How to Get Your Question Answered Quickly

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

View solution in original post

5 REPLIES 5
amitchandak
Super User
Super User

@Anonymous For and use && and For OR is || , use in for or of same filter

 

([Filter A] = "b" || [Filter B] = "b") && [Filter C] = "x" && ([filter D] in{ "1" ,"2"} )

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Hello,

Thanks for the reply but it will not allow me to do what you advised. Below is the image of the error I get.

 

thorton_1-1652795017589.png

 

Anonymous
Not applicable

Hi @Anonymous ,

 

Try this measure.

Measure = 
CALCULATE(
    DISTINCTCOUNT('Main'[ID]),
    FILTER('Main',
        ('Main'[ADMITSTATUS]="N"||'Main'[ETHNICITY]="N")
        &&'Main'[CITIZEN]="Y"
    )
)

If this doesn't work for you, would you mind sharing a sample data without privacy and tell me what data you want to filter out? Thanks in advance.

 

How to provide sample data in the Power BI Forum

How to Get Your Question Answered Quickly

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

Anonymous
Not applicable

Thanks that worked.

Anonymous
Not applicable

Hello,

Thanks for the reply but it will not allow me to do what you advised. Below is the image of the error I get.

 

thorton_0-1652794872243.png

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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