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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.