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!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
Hello,
I am sure this has been address.
I've hacked away at this forum but could not find the response.
Current Situaiton
Problem
Thx in advance for all your help.
Hi,
this is one way of solving your issue, although sligthly verbose:
MeasureCurrentYear cumulative =
VAR _year =
CALCULATE ( SELECTEDVALUE ( Dates[Year] ) )
VAR _month =
CALCULATE ( SELECTEDVALUE ( Dates[MonthNum] ) )
VAR _maxMonthCurrentYear =
CALCULATE (
MAX ( 'Table'[month] ),
FILTER ( ALL ( 'Table' ), 'Table'[Year] = _year )
)
RETURN
IF (
_month <= _maxMonthCurrentYear
&& HASONEVALUE ( Dates[Month] ),
CALCULATE (
SUM ( 'Table'[NumberOfPassengers] ),
FILTER ( ALL ( Dates ), Dates[Year] = _year && Dates[MonthNum] <= _month )
),
IF (
NOT ( HASONEVALUE ( Dates[Month] ) ),
SUMX (
CALCULATETABLE (
'Table',
FILTER (
ALL ( 'Table' ),
'Table'[Year] = _year
&& 'Table'[month] <= _maxMonthCurrentYear
)
),
'Table'[NumberOfPassengers]
),
BLANK ()
)
)
MeasureCurrentYear-1 cumulative =
VAR _year =
CALCULATE ( SELECTEDVALUE ( Dates[Year] ) )
VAR _month =
CALCULATE ( SELECTEDVALUE ( Dates[MonthNum] ) )
VAR _maxMonthCurrentYear =
CALCULATE (
MAX ( 'Table'[month] ),
FILTER ( ALL ( 'Table' ), 'Table'[Year] = _year )
)
RETURN
IF (
_month <= _maxMonthCurrentYear
&& HASONEVALUE ( Dates[Month] ),
CALCULATE (
SUM ( 'Table'[NumberOfPassengers] ),
FILTER ( ALL ( Dates ), Dates[Year] = _year - 1 && Dates[MonthNum] <= _month )
),
IF (
NOT ( HASONEVALUE ( Dates[Month] ) ),
SUMX (
CALCULATETABLE (
'Table',
FILTER (
ALL ( 'Table' ),
'Table'[Year] = _year - 1
&& 'Table'[month] <= _maxMonthCurrentYear
)
),
'Table'[NumberOfPassengers]
),
BLANK ()
)
)