Handling Negative Margin Calculation

My DAX for the Margin is simply

Project Margin Pct = DIVIDE([Project Margin],[Total Revenue],0)

The proble I have is when the Revenue is Negative and the Project Margin is Negative, the Margin is showing as a positive, when it should really be a negative.

In Excel I would do something like…

=IF(‘Total Revenue’<0,-IFERROR(‘Project Margin’/‘Total Revenue’,0),IFERROR(‘Project Margin’/‘Total Revenue’,0))*100

1 Like

Sorted it, but not sure if this is the most elegant solution.

Project Margin Pct = IF([Total Revenue]<0,-DIVIDE([Project Margin],[Total Revenue],0),DIVIDE([Project Margin],[Total Revenue],0))

Hi Neville,

Best formula I’ve found for dealing with this is as follows:

= IFERROR( [Project Margin] / ABS([Revenue]), 0)

1 Like

That’s great. Chrs

Cool, like this one.

Never thought of using ABS, but so much better. Thanks