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

if Value.Is Zero Then?

I am using the formula in m language calculated column "=if Value.Is([#"MDBF Years.2018 - YEAR 1"],0)then [#"MDBFMileage.MDBF Mileage Year 1 - 2018"] else ([#"MDBFMileage.MDBF Mileage Year 1 - 2018"]/[#"MDBF Years.2018 - YEAR 1"])"

 

The goal is to identify fields with the number zero, I attempted to replace "0" with null and still return an "ERROR"

 

Does anyone have any guidance on this formula?

1 ACCEPTED SOLUTION
Zubair_Muhammad
Community Champion
Community Champion

@erikah06

Try the normal if statement

 

=if
[#"MDBF Years.2018 - YEAR 1"]=0
then
[#"MDBFMileage.MDBF Mileage Year 1 - 2018"]
else
[#"MDBFMileage.MDBF Mileage Year 1 - 2018"]/[#"MDBF Years.2018 - YEAR 1"]

View solution in original post

2 REPLIES 2
Zubair_Muhammad
Community Champion
Community Champion

@erikah06

Try the normal if statement

 

=if
[#"MDBF Years.2018 - YEAR 1"]=0
then
[#"MDBFMileage.MDBF Mileage Year 1 - 2018"]
else
[#"MDBFMileage.MDBF Mileage Year 1 - 2018"]/[#"MDBF Years.2018 - YEAR 1"]

Thank @Zubair_Muhammad this worked perfectly. 

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!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.