Forum Discussion
Subtract values from two rows in matrix
- 5 years ago
Hi maart666 ,
Modify your measure as below:
Difference = VAR thisforecastnum = MIN ( Arkusz1[Forecast no] ) VAR thisforecast = SUM ( Arkusz1[Qty] ) var lastforecastnum=CALCULATE(MAX('Arkusz1'[Forecast no]),FILTER(ALLSELECTED(Arkusz1),'Arkusz1'[Forecast no]<MAX('Arkusz1'[Forecast no]))) VAR lastforecast = CALCULATE ( SUM ( Arkusz1[Qty] ), Arkusz1[Forecast no] = lastforecastnum ) RETURN IF ( ISBLANK ( lastforecast ), BLANK (), thisforecast - lastforecast )And you will see:
For the related .pbix file,pls see attached.
Best Regards,
KellyDid I answer your question? Mark my post as a solution!
This measure expression will give you the difference from the current forecast to the previous one.
Difference =
VAR thisforecastnum =
MIN ( Arkusz1[Forecast no] )
VAR thisforecast =
SUM ( Arkusz1[Qty] )
VAR lastforecast =
CALCULATE (
SUM ( Arkusz1[Qty] ),
Arkusz1[Forecast no] = thisforecastnum - 1
)
RETURN
IF (
ISBLANK ( lastforecast ),
BLANK (),
thisforecast - lastforecast
)
To get your % difference, just change the Return part using the same variable (e.g., DIVIDE(thisforecast - lastforecast, lastforecast)
Regards,
Pat