Forum Discussion
Calculate difference between versions of Forecast data
- 11 months ago
and try this
Measure = VAR NumQuarter = SELECTEDVALUE('Sales Forecast'[NumQuarter])-1 VAR PQTY = CALCULATE([FCST_QTY], 'Sales Forecast'[NumQuarter]= NumQuarter , REMOVEFILTERS('DimVersionNo'),REMOVEFILTERS(DimFYFISCAL)) RETURN [FCST_QTY] - PQTY
Hi mbudiman,
You can achieve it by first clculating previous version forecast
PrevVersionForecast =
VAR CurrentFiscal = MAX('Forecast'[Fiscal Qtr])
VAR CurrentVersionNo = MAX('Forecast'[Version No])
RETURN
CALCULATE(
MAX('Forecast'[Forecast Qty]),
FILTER(
ALL('Forecast'),
'Forecast'[Fiscal Qtr] = CurrentFiscal &&
'Forecast'[Version No] = CurrentVersionNo + 1
)
)
Then calculating the difference between them
ForecastDifference =
VAR CurrentForecast = MAX('Forecast'[Forecast Qty])
VAR PreviousForecast = [PrevVersionForecast]
RETURN
IF(
NOT ISBLANK(PreviousForecast),
CurrentForecast - PreviousForecast,
BLANK()
)
π I hope this solution helps you unlock your Power BI potential! If you found it helpful, click 'Mark as Solution' to guide others toward the answers they need.
π‘ Love the effort? Drop the kudos! Your appreciation fuels community spirit and innovation.
π As a proud SuperUser and Microsoft Partner, weβre here to empower your data journey and the Power BI Community at large.
π Curious to explore more? [Discover here].
Letβs keep building smarter solutions together!