DAX measure to exclude positive values from existing measure

I’m trying to create a DAX measure that excludes positive values from an existing measure named “Write Off”. This measure calculates the difference between invoiced amount and invoiced amount billable. Thanks in advance.
Here’s the existing measure definition:

Write Off = Invoiced Amount Time - Invoiced Amount Billable

Note that these table are already the results from the measure and I wanted to exclude the positive values and retain the negative values.

Write Off Task Name
-1500 13746
-1020 13917.2
-840 13917.4
-780 13917.1
-480 14190
-420 13917.3
-390.39 13925
-337.56 14305
-240 13769
-120 13917.2
-22.79 13299
0.34 14182
58.8 13984
201.49 13937
215.66 14305
311.25 14016
893.98 14287

data.csv (1004 Bytes)

Hi @ronald_balza ,

You can check at sample pbi

Negative Calculation.pbix (17.6 KB)

Hope that is what are you looking for.

1 Like

Hi @mspanic, thanks for your help! I understand your approach, but what if the “write off” already exists as a measure instead of a column? How would I modify the code to accommodate this change? I tried the below but obviously, there will be an error. Thanks so much!

Negative calculation = CALCULATE(
    SUMX('Invoice WIP Ledger Report', [Write Off]),
    [Write Off] < 0

Here’s the updated pbix file.

Negative Calculation.pbix (30.2 KB)

Hi @ronald_balza ,

As usual DAX solution is in details and context :slight_smile:

So in this case thar you describing above you can check:

Negative Calculation_1.pbix (30.9 KB)

Hope it helps.