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
AlexDawson111
Frequent Visitor

Measure Returning More Rows and NaN value

Hi,

 

I am writing the following measure which is working correctly but is returning a Nan value for one field. I have tried dealing with this Nan value by doing an if else measure. However when i do this it returns more rows. Any help would be great.

 

1) Measure Working but returning Nan Value

 

Labour Units Complete % = 'P6 Measures'[Actual Hours]/'P6 Measures'[At Completion Hours]
 
Screenshot1.png

 

 

2) Measure to deal with Nan value returning more rows

 

Labour Units Complete % = IF(SUM(fact_P6_Units_Hours_Durations[At Completion Labor Hours]) = 0,0,'P6 Measures'[Actual Hours]/'P6 Measures'[At Completion Hours])
 
Screenshot2.png

 

  

 

 

 

 

1 ACCEPTED SOLUTION
AlexDawson111
Frequent Visitor

I believe i have found the solution. Please correct if wrong.

 

I have used the DIVIDE function which can handle the ability to divide by 0. 

 

Labour Units Complete % = DIVIDE('P6 Measures'[Actual Hours],[At Completion Hours])

View solution in original post

2 REPLIES 2
AlexDawson111
Frequent Visitor

I believe i have found the solution. Please correct if wrong.

 

I have used the DIVIDE function which can handle the ability to divide by 0. 

 

Labour Units Complete % = DIVIDE('P6 Measures'[Actual Hours],[At Completion Hours])

Hi @AlexDawson111 

 

You have found the best solution to this problem. The DIVIDE function was designed to automatically handle division by zero cases. If an alternate result is not passed in, and the denominator is zero or BLANK, the function returns BLANK. Visuals will not show blank values by default.

 

If you want to use an IF statement to check the denominator first, you can return BLANK() instead of 0 when the denominator is blank or 0. This will get you the same visual without many blank rows. 

Labour Units Complete % =
IF (
    SUM ( fact_P6_Units_Hours_Durations[At Completion Labor Hours] ) = 0,
    BLANK (),
    'P6 Measures'[Actual Hours] / 'P6 Measures'[At Completion Hours]
)

 

For best practice about using DIVIDE or divide operator(/), you can read this article: DIVIDE function vs divide operator (/) in DAX - DAX | Microsoft Docs

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

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.