cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Sign of absolute value in a measure

Hi all,

 

I have this formula which is present in a matrix visualization

 

 

M = CALCULATE(SUMX(ProdForecast,abs([TotalActual]-ProdForecast[Forecast])),'M view'[Category]="M")

 


My headache today is to somehow determine what is the sign of 

 

 

[TotalActual]-ProdForecast[Forecast]

 

 

 before the ABS formula is applied.

Example: If TotalActual-Forecast is -8 in the matrix I will have 8 but somehow to determine the initial sign and put it as conditional formating or something in a matrix.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User IV
Super User IV

https://docs.microsoft.com/en-us/dax/sign-function-dax

 

M = 
  VAR __Sign = SIGN(ProdForecast[TotalActual]-ProdForecast[Forecast])
RETURN
  CALCULATE(SUMX(ProdForecast,abs([TotalActual]-ProdForecast[Forecast])),'M view'[Category]="M")

---------------------------------------

@ me in replies or I'll lose your thread!!!

I have a NEW book! 
DAX Cookbook from Packt
Over 120 DAX Recipes!




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

1 REPLY 1
Highlighted
Super User IV
Super User IV

https://docs.microsoft.com/en-us/dax/sign-function-dax

 

M = 
  VAR __Sign = SIGN(ProdForecast[TotalActual]-ProdForecast[Forecast])
RETURN
  CALCULATE(SUMX(ProdForecast,abs([TotalActual]-ProdForecast[Forecast])),'M view'[Category]="M")

---------------------------------------

@ me in replies or I'll lose your thread!!!

I have a NEW book! 
DAX Cookbook from Packt
Over 120 DAX Recipes!




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Community Conference

Microsoft Power Platform Communities

Check out the Winners!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors