Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Good evening,
I am still new to Power Query and haven’t created many custom formulas. Below is an Excel formula I need assistance recreating in Power Query.
=IF(AND(P3="BLANK1",Q3="BLANK2",R3="BLANK3"),"Investigate",IF(AND(P3=Q3,P3=R3),P3,IF(AND(P3<>"BLANK1",Q3="BLANK2",R3="BLANK3"),P3,IF(AND(P3=R3,Q3="BLANK2"),P3,IF(AND(P3<>R3,P3<>"BLANK1",R3<>"BLANK3",Q3="BLANK2"),"300-Corporate",IF(AND(P3<>"BLANK1",Q3<>"BLANK2",P3<>Q3,R3="BLANK3"),"300-Corporate",IF(AND(P3="BLANK1",Q3<>"BLANK2",R3="BLANK3"),Q3,IF(AND(P3="BLANK1",Q3<>"BLANK2",Q3<>R3),"300-Corporate",IF(AND(P3="BLANK1",Q3="BLANK2",R3<>"BLANK3"),R3,IF(AND(P3<>"BLANK1",Q3<>"BLANK2",R3<>"BLANK3",P3<>Q3,Q3<>R3),"300-Corporate",IF(AND(P3="BLANK1",Q3=R3),Q3,IF(AND(P3=Q3,R3="BLANK3"),P3,IF(AND(P3=Q3,P3<>R3,R3<>"BLANK3"),"300-Corporate",IF(AND(P3<>"BLANK1",P3<>Q3,Q3=R3),"300-Corporate","ERROR"))))))))))))))
Thank you in advance for your assistance.
Solved! Go to Solution.
Hi @aliciab425 ,
I'm not going to completely rewrite the formula, but here is the structure and terminology you need to do this in Power Query:
if [AST Terr 1] = "BLANK1" and [AST Terr 2] = "BLANK2" and [AST Terr 3] = "BLANK3" then "investigate"
else if [AST Terr 1] = [AST Terr 2] and [AST Terr 1] = [AST Terr 3] then [AST Terr 1]
else if [AST Terr 1] <> "BLANK1" and [AST Terr 2] = "BLANK2" and [AST Terr 3] = "BLANK3" then [AST Terr 1]
else if...
...
else //your escape value here e.g. null, "ERROR" etc.
Any logical operators (+, *, <, > etc.) can be used in exactly the same way as in Excel.
Pete
Proud to be a Datanaut!
Hi! @aliciab425
It would be easy to write the formula if you can share the sample data and expected result.
Hi @aliciab425 ,
I'm not going to completely rewrite the formula, but here is the structure and terminology you need to do this in Power Query:
if [AST Terr 1] = "BLANK1" and [AST Terr 2] = "BLANK2" and [AST Terr 3] = "BLANK3" then "investigate"
else if [AST Terr 1] = [AST Terr 2] and [AST Terr 1] = [AST Terr 3] then [AST Terr 1]
else if [AST Terr 1] <> "BLANK1" and [AST Terr 2] = "BLANK2" and [AST Terr 3] = "BLANK3" then [AST Terr 1]
else if...
...
else //your escape value here e.g. null, "ERROR" etc.
Any logical operators (+, *, <, > etc.) can be used in exactly the same way as in Excel.
Pete
Proud to be a Datanaut!
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
9 | |
7 | |
5 | |
5 | |
5 |