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!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
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 ()
)
)
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 38 | |
| 36 | |
| 33 | |
| 30 | |
| 28 |
| User | Count |
|---|---|
| 127 | |
| 88 | |
| 78 | |
| 66 | |
| 65 |