Forum Discussion

Saloni_Gupta's avatar
Saloni_Gupta
Helper I
2 years ago
Solved

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.

 

 

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

 


 

  • 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

1 Reply

  • _AAndrade's avatar
    _AAndrade
    Resident Rockstar

    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