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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
FoxInSocks
New Member

DAX Filter pulls up unrelated records

Good afternoon everyone,

 

Working on some code for a DB, and there's a field I use to extract pay on a specific named basis. Though the first part of the code pulls the second parameter when I only want the first. An example;

 

if ([PayRange] = "2020FebPay" or [PayRange] = "2020AprPay" or [PayRange] = "2020JulPay" or [PayRange] = "2020OctPay") and [Contact] = "Paymaster Record1" or [Contact] = "Paymaster Record2" then [Pay] else if ([PayRange] = "2020DecPay" and [Contact] = "Paymaster Record2") then [Pay] else if [PayRange] = "BonusNovPay" and [PayRange] = "Paymaster Record1" then [Pay] else null

 

BonusNovPay still picks up some Paymaster record 2 contacts. Is there any way to fix?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hey there. It should be

 

and ([Contact] = "Paymaster Record1" or [Contact] = "Paymaster Record2") then [Pay]...

 

That said, I'd advise you to stay consistent and disciplined with your if/and statements, like when you place some "and" statements in parentheses, but not others, leading to the issue you are experiencing!

 

--Nate

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hey there. It should be

 

and ([Contact] = "Paymaster Record1" or [Contact] = "Paymaster Record2") then [Pay]...

 

That said, I'd advise you to stay consistent and disciplined with your if/and statements, like when you place some "and" statements in parentheses, but not others, leading to the issue you are experiencing!

 

--Nate

Fantastic! Thanks for the assistance. I'll be sure to clean up my statements a bit more!

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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

Top Solution Authors