Forum Discussion
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?
- Anonymous4 years ago
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
2 Replies
- AnonymousNot 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
- FoxInSocksNew Member
Fantastic! Thanks for the assistance. I'll be sure to clean up my statements a bit more!