Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register 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 ()
)
)
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
84 | |
75 | |
68 | |
39 | |
35 |
User | Count |
---|---|
107 | |
56 | |
52 | |
48 | |
40 |