Forum Discussion
Help with DAX measure - Dynamically recalculated target
Hi Rai_Lomarques , Thank you for reaching out to the Microsoft Community Forum.
Please try below:
Goal Rollout =
VAR DateCurrent = MAX('dCalendar'[Date])
VAR YearCurrent = YEAR(DateCurrent)
VAR MonthCurrent = MONTH(DateCurrent)
VAR QuarterCurrent = QUARTER(DateCurrent)
VAR PriorMonths =
FILTER(
ALL('dCalendar'),
YEAR('dCalendar'[Date]) = YearCurrent &&
'dCalendar'[Date] < DateCurrent
)
VAR TotalGoalPrior = CALCULATE([Goal $], PriorMonths)
VAR TotalSalesPrior = CALCULATE([Sellin $], PriorMonths)
VAR CumulativeGap = MAX(0, TotalGoalPrior - TotalSalesPrior)
VAR RemainingMonths =
FILTER(
ALL('dCalendar'),
YEAR('dCalendar'[Date]) = YearCurrent &&
QUARTER('dCalendar'[Date]) = QuarterCurrent &&
MONTH('dCalendar'[Date]) >= MonthCurrent
)
VAR RemainingTarget = CALCULATE([Goal $], RemainingMonths)
VAR CurrentMonthTarget =
CALCULATE(
[Goal $],
FILTER(
RemainingMonths,
MONTH('dCalendar'[Date]) = MonthCurrent
)
)
VAR Weight = DIVIDE(CurrentMonthTarget, RemainingTarget, 0)
VAR Result = CurrentMonthTarget + (CumulativeGap * Weight)
RETURN Result
This calculates the full year-to-date deficit (e.g., January’s $50,000 gap), then splits it proportionally (45%/55%) across February and March, yielding $922,500 and $1,127,500 as you specified.
If this helped solve the issue, please consider marking it 'Accept as Solution' so others with similar queries may find it more easily. If not, please share the details, always happy to help.
Thank you.