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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Nested IF ELSE is not working - HELP PLEASE

I want to extract a different set of text from a column called "Description" when I used the Nested IF else statement in the custom column on power query it is not working or I could say the "OR" condition is not working.

 

Below is my complete query: The highlighted green color query is working but the remiaing part throwing an error

 

Error:

Expression.Error: 1 arguments were passed to a function which expects between 2 and 3.
Details:
Pattern=
Arguments=[List

 

Query:

if Text.Contains([Description],"Sptool identified") then Text.BetweenDelimiters([Description], "1.Exception: ", "2.Proce") as text
else
if Text.Contains([Description],"the exception being:") then Text.BetweenDelimiters([Description], "being:", "The impacted") as text
else
if Text.Contains([Description]="invoice" or [Description]="eRTY" or [Description]="EnGMT" or[Description]="buET" or [Description]="ECT") then "CPM" as text
else "Check"

1 ACCEPTED SOLUTION
Vijay_A_Verma
Super User
Super User

Use below

if Text.Contains([Description],"Sptool identified") then Text.BetweenDelimiters([Description], "1.Exception: ", "2.Proce") as text
else
if Text.Contains([Description],"the exception being:") then Text.BetweenDelimiters([Description], "being:", "The impacted") as text
else
if List.ContainsAny({[Description]},{"invoice","eRTY","EnGMT","buET","ECT"},(x as text, y as text)=>Text.Contains(x,y)) then "CPM" as text
else "Check"

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

@Vijay_A_Verma  - Thanks a lot. Its working!

Vijay_A_Verma
Super User
Super User

Use below

if Text.Contains([Description],"Sptool identified") then Text.BetweenDelimiters([Description], "1.Exception: ", "2.Proce") as text
else
if Text.Contains([Description],"the exception being:") then Text.BetweenDelimiters([Description], "being:", "The impacted") as text
else
if List.ContainsAny({[Description]},{"invoice","eRTY","EnGMT","buET","ECT"},(x as text, y as text)=>Text.Contains(x,y)) then "CPM" as text
else "Check"

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.