Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Experts,
I am having a scenario, Assume have only one measure and that should show current year YTD i.e June 2023 and Previous Year YTD till June 2022 only. How would I made my measure should show for the Current Year YTD vs. Previous Year YTD in the same measure dynamically? Below is the ssnapshot that my measure is displays the Current Year 2023 YTD is looks good, but for 2022 it is summing till Dec 2022. please help?
Hi @Anonymous ,
Maybe the function SAMEPERIODLASTYEAR could help you.
It returns a table that contains a column of dates shifted one year back in time from the dates in the specified dates column, in the current context.
Besides, you can use something like this:
Measure =
VAR _a =
MAXX ( ALL ( 'Table'[Date] ), [Date] ) //get the max date
VAR _b =
EOMONTH ( _a, -12 ) //end of the same month in last year
RETURN
CALCULATE (
SUM ( [Value] ),
FILTER ( ALL ( 'Table' ), [Date] <= _b && YEAR ( [Date] ) = YEAR ( _a ) - 1 )
)
Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @amitchandak please help on this, you helped me in multiple work arounds. Thanks 🙂
User | Count |
---|---|
25 | |
12 | |
8 | |
7 | |
7 |
User | Count |
---|---|
25 | |
12 | |
11 | |
10 | |
6 |