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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Conditional Column not working (M against Measure)

Hi,

 

If I use 

 

Type of Sale = IF(insertBK[ClassOfBusiness] = "Bus Acc","BA",IF(insertBK[TrueCompany]="HOUSE ADVERT","House",IF(insertBK[iadclass] = 9014, "Local Remnant"," ")))

 

In a measure it works fine.

 

However if I try and to use it in a calculated column ie

 

 #"Added Conditional Column" = Table.AddColumn(#"Removed Blank Rows", "Type of Sale", each if [ClassOfBusiness] = """BUS ACC""" then "BA" else if [TrueCompany] = """HOUSE ADVERT""" then "House" else if [iadclass] = 9014 then "Local Remnant" else if [SourceCode] = """BA430""" then "National" else if [SourceCode] = """CA148""" then "National" else if [SourceCode] = """HX355""" then "National" else if [SourceCode] = """MD301""" then "National" else "local" )

 

It doesnt work and only classifies 'Local Remant'.

 

Any ideas?

 

Thanks

 

Chris

 

1 ACCEPTED SOLUTION

The M code has duplicated double quotes, contrary to the DAX code.

Specializing in Power Query Formula Language (M)

View solution in original post

2 REPLIES 2
vanessafvg
Super User
Super User

@Anonymous powerquery is case sensitive, have you typed the condition exactly as it is in the data?





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




The M code has duplicated double quotes, contrary to the DAX code.

Specializing in Power Query Formula Language (M)

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Top Solution Authors