I am transitioning a Tableau Dashboard over to Power BI and am newer to using DAX. I need to create this same type of measure or calculated column into PowerBI.
So far I have tried using containsstring with an if statement and can get it to work with one option, but when I try adding other selections it doesn’t work.
Tableau Measure
CARES / Unapplied / Forward Balance / Interest Payment
IF [Pat First Name] == “BONUS”
THEN “CARES CR”
ELSEIF
CONTAINS(UPPER([Pat Last Name]),“UNAPPLIED”) OR
CONTAINS(UPPER([Pat First Name]),“UNAPPLIED”) OR
CONTAINS(UPPER([Pat Last Name]),“UNALLOCATED”) OR
CONTAINS(UPPER([Pat First Name]),“UNALLOCATED”) OR
UPPER([Pat First Name]+" “+[Pat Last Name])==“TOS 2021 UNKNOWN” OR
UPPER([Pat First Name]+” "+[Pat Last Name])==“UNKNOWN PAYMENTS” OR
CONTAINS(UPPER([Pat Last Name]),“RECEIPTS”) OR
(
UPPER([Pat First Name])==“TRANSACTION” AND
UPPER([Pat Last Name]) IN (“2021”,“FEES 2021”)
) OR
(
UPPER([Pat First Name])==“ACCOUNT” AND
CONTAINS(UPPER([Pat Last Name]),“ZZ”)
) OR
(
UPPER([Pat First Name])==“UNK” AND
UPPER([Pat Last Name]) IN (“BULK EFT”,“AETNA”,“UHC”)
)
THEN “Unapplied”
ELSEIF
CONTAINS(UPPER([Pat Last Name]),“INTEREST”)
THEN “Interest Payment”
ELSEIF
CONTAINS(UPPER([Pat Last Name]),“FORWARD BALANCE”)
THEN “Forward Balance”
END
I noticed you didn’t provide a PBIX file. Providing one will help users and experts find a solution to your inquiry faster and better.
A perfect initial question includes all of the following:
A clear explanation of the problem you are experiencing
A mockup of the results you want to achieve
Your current work-in-progress PBIX file
Your underlying data file (to allow us to go into Power Query if necessary to transform your data and/or data model – often DAX questions really end up being data modeling solutions)
While our users and experts do as much as reasonable to help you with your inquiries, not all concerns can be attended to especially if there are some learnings to be done. Thank you!