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
Sime
Helper I
Helper I

Custom Column with DAX IF Statement

Hi All,

 

I'm attempting to create a custom column using an IF Statement and by Dividing 2 already existing columns.

 

I have tried the following:

 

IF([JTD Earned Value] = 0, "1", [JTD Earned Value] / [#"JTD Labour Amount @ Cost"])

 

And whilst the syntax appears to be correct, I get this error when I click OK.

 

Expression.Error: The name 'IF' wasn't recognized. Make sure it's spelled correctly.

 

I know i can do this in a measure but I need it as a DAX command to SUM correctly in a Multi-Grid control.

 

Thanks in advance.

1 ACCEPTED SOLUTION
Angith_Nair
Continued Contributor
Continued Contributor

Hi @Sime ,

In Power Query, add a custom column and write this code..

if [JTD Earned Value] = 0 then "1" else [JTD Earned Value] / [JTD Labour Amount @ Cost]

View solution in original post

3 REPLIES 3
Sime
Helper I
Helper I

Thank you both for your assistance. Problem rectified. 

Angith_Nair
Continued Contributor
Continued Contributor

Hi @Sime ,

In Power Query, add a custom column and write this code..

if [JTD Earned Value] = 0 then "1" else [JTD Earned Value] / [JTD Labour Amount @ Cost]

HotChilli
Super User
Super User

This part     -    #"JTD Labour Amount @ Cost"   - leads me to think you're in Power Query.   Fair enough but you can't write DAX in Power Query. You need to write M and there is an 'if then else' in M.

Does that help?

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.