Neville
November 9, 2018, 10:14am
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

1 Like

Neville
November 9, 2018, 10:38am
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))

Hi Neville,

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

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

1 Like

Neville
November 15, 2018, 2:00pm
6
Never thought of using ABS, but so much better. Thanks