The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
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 |
---|---|
15 | |
8 | |
6 | |
6 | |
5 |
User | Count |
---|---|
23 | |
13 | |
13 | |
8 | |
8 |