Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi,
I have quick question.
Is it possible to create measure which will sum cumulatevily values over 2 years?
I mean it must be something like YTD, but for 2 years, not only one year.
My current measure looks like this:
My problem arise when 2020 start, so my cumulative Revenues are approximately 0, but I need to sum them with previous year cumulatevily.
Solved! Go to Solution.
Hi @pawelj795 ,
First, one step in the above formula was complicated by me. I have modified it. Please check:
YTD Revenues 5 =
VAR LastYearFirstDate =
IF (
SELECTEDVALUE ( 'Calendar'[Year] ) = BLANK (),
DATE ( YEAR ( LASTDATE ( Invent_Trans[Date] ) ) - 1, 1, 1 ),
DATE ( SELECTEDVALUE ( 'Calendar'[Year] ) - 1, 1, 1 ) -------------changed
)
VAR CurrentDate =
IF (
SELECTEDVALUE ( 'Calendar'[Year] ) = BLANK (),
MAX ( DimDates[Date] ),
CALCULATE (
MAX ( DimDates[Date] ),
FILTER ( DimDates, DimDates[Year] = SELECTEDVALUE ( 'Calendar'[Year] ) )
)
)
RETURN
CALCULATE (
SUM ( Invent_Trans[Inventory Value] ),
FILTER (
ALLSELECTED ( DimDates ),
DimDates[Date] >= LastYearFirstDate
&& DimDates[Date] <= CurrentDate
)
)
Then, you can create your YearWeek column like so:
YearWeek =
CONCATENATE (
Invent_Trans[Year],
CONCATENATE ( " ", FORMAT ( Invent_Trans[WeekNum], "00" ) )
)
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
114 | |
99 | |
82 | |
70 | |
60 |
User | Count |
---|---|
148 | |
116 | |
104 | |
89 | |
65 |