Forum Discussion
Sofinobi
Helper IV
2 years agocalculate the diffrence
hi all, please, i have a measure to calculate the diffrence between the Sales and Target (Diff = Sales - Target), when i visualize this in a Table by Client, so i have positive and negative results ...
talespin
Solution Sage
2 years agoHi Sofinobi ,
Using below to simulate your use case. This will give you sum of negative numbers, you need to replace summarize with your visual level filters if any or otherwise with table column that you want to group by(Example difference for products here).
Replace it with your measure that returns the difference.([MQuantity]- [MCustomQuantity] )
MDiff =
SUMX(
SUMMARIZE(DimProduct, DimProduct[EnglishProductName]),
VAR Diff = [MQuantity]- [MCustomQuantity]
RETURN
IF(Diff < 0, Diff, 0)
)