Handling Negative Margin Calculation


#1

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


#2

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))


#3

Hi Neville,

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

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


#4

That’s great. Chrs


#5

Cool, like this one.