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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Saloni_Gupta
Helper I
Helper I

DIVIDE function not handling division by zero

Hi All,
I have a simple dax calculation for Revenue and EM% as below:

Revenue - FYTD =
var temp = CALCULATE(SUM('FactMonthlyRevenueandBudget'[ActualsRevenue]),'Month Table'[YTD Flag] = "Y")
RETURN
IF(temp = 0,BLANK(),temp)
EM % - FYTD =
var Result = DIVIDE([EM $ - FYTD],[Revenue - FYTD])
RETURN
IF(not ISBLANK([Revenue - FYTD]) || [Revenue - FYTD] <> 0,Result)

Although Divide function has the ability to handle division by zero but for 1 special case, when this Revenue aggregates to 0 in Totals as shown below for jobid starting with "595", my EM% values gives me this weird value.
Saloni_Gupta_2-1707932658834.png

 

Saloni_Gupta_3-1707932994526.png

 

Can you please help me resolve this issue as I dont want to show any EM% value if Revenue is 0 or blank?

 


 

1 ACCEPTED SOLUTION
_AAndrade
Super User
Super User

It's seems it's not zero on that row but a small number. Try to use the round function to see if it's the real problem





Did I answer your question? Mark my post as a solution! Kudos are welcome.

Proud to be a Super User!




View solution in original post

1 REPLY 1
_AAndrade
Super User
Super User

It's seems it's not zero on that row but a small number. Try to use the round function to see if it's the real problem





Did I answer your question? Mark my post as a solution! Kudos are welcome.

Proud to be a Super User!




Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.