Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
Hello everyone,
I have this measure that calculates YTD Actual (-2 months) + Budget of months left.
When I use the following with "Calculate(SUM))" everything works perfectly:
Solved! Go to Solution.
Try this. Each measure needs a CALCULATE.
Act + Bdgt_GP_Bef_Com =
VAR _max1 =
MAXX ( ALLSELECTED ( Dates ), Dates[Date_2] )
VAR _max =
EOMONTH ( DATE ( YEAR ( _max1 ), MONTH ( _max1 ) - 2, 1 ), 0 )
VAR _min =
DATE ( YEAR ( _max1 ), 1, 1 )
VAR _minb =
DATE ( YEAR ( _max1 ), MONTH ( _max1 ) - 2, 1 )
VAR _maxb =
DATE ( YEAR ( _max1 ), 12, 31 )
RETURN
CALCULATE (
[YTD_GP_Before_Com],
FILTER ( Dates, Dates[Date_2] <= _max && Dates[Date_2] >= - _min )
)
+ CALCULATE (
[YTD_Bdgt_GP_Before_Com], FILTER(Dates, Dates[Date_2] <= _maxb
&& Dates[Date_2] >= _minb
)
Proud to be a Super User!
You need the CALCULATE function:
Act + Bdgt_GP_Bef_Com =
VAR _max1 =
MAXX ( ALLSELECTED ( Dates ), Dates[Date_2] )
VAR _max =
EOMONTH ( DATE ( YEAR ( _max1 ), MONTH ( _max1 ) - 2, 1 ), 0 )
VAR _min =
DATE ( YEAR ( _max1 ), 1, 1 )
VAR _minb =
DATE ( YEAR ( _max1 ), MONTH ( _max1 ) - 2, 1 )
VAR _maxb =
DATE ( YEAR ( _max1 ), 12, 31 )
RETURN
CALCULATE (
[YTD_GP_Before_Com],
FILTER ( Dates, Dates[Date_2] <= _max && Dates[Date_2] >= - _min ) + [YTD_Bdgt_GP_Before_Com]], FILTER(Dates, Dates[Date_2] <= _maxb
&& Dates[Date_2] >= _minb
)
Proud to be a Super User!
@DataInsights thanks a lot for your answer.
The function seems to work however it says now "A function 'FILTER' has been used in a True/False expression that is used as a table filter expression. This is not allowed."
Any ideas what could cause this?
Thanks a lot for your helps,
Nick
Try this. Each measure needs a CALCULATE.
Act + Bdgt_GP_Bef_Com =
VAR _max1 =
MAXX ( ALLSELECTED ( Dates ), Dates[Date_2] )
VAR _max =
EOMONTH ( DATE ( YEAR ( _max1 ), MONTH ( _max1 ) - 2, 1 ), 0 )
VAR _min =
DATE ( YEAR ( _max1 ), 1, 1 )
VAR _minb =
DATE ( YEAR ( _max1 ), MONTH ( _max1 ) - 2, 1 )
VAR _maxb =
DATE ( YEAR ( _max1 ), 12, 31 )
RETURN
CALCULATE (
[YTD_GP_Before_Com],
FILTER ( Dates, Dates[Date_2] <= _max && Dates[Date_2] >= - _min )
)
+ CALCULATE (
[YTD_Bdgt_GP_Before_Com], FILTER(Dates, Dates[Date_2] <= _maxb
&& Dates[Date_2] >= _minb
)
Proud to be a Super User!