Forum Discussion
Creating a custom year between two dates for a measure, e.g. 12 August 2019 to 12 August 2020
Hi all,
I've tried to search for a solution to this, but I can't find one--however I think this is more of a case that I'm not sure of the terms I should be searching for. Any links would be helpful to existing posts.
So I have a measure like this:
Bemused , Based on initial Description
Means from
12 August 2019 to 11 August 2020
Calendar = calendar(Date(2019,08,12),Date(2020,08,11)) // New calendar table
Start of year = Startofyear([Date], "08/11")
Endof year = Endofyear([Date], "08/11")
Start of month = eomonth([Date], -1) +12
End of month = eomonth([Date], 0) +11
Based on Start date month, year , you can create Rank and use that for Current Vs prior
Year Rank = RANKX(all('Date'),'Date'[Year Start date],,ASC,Dense)
Measure
This Year = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),h'Date'[Year Rank]=max('Date'[Year Rank])))
Last Year = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Year Rank]=max('Date'[Year Rank])-1))Power BI — Year on Year with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a
https://www.youtube.com/watch?v=km41KfM_0uAPower BI — Month on Month with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-mtd-questions-time-intelligence-3-5-64b0b4a4090e
https://www.youtube.com/watch?v=6LUBbvcxtKA
1 Reply
- amitchandak
Super User
Bemused , Based on initial Description
Means from
12 August 2019 to 11 August 2020
Calendar = calendar(Date(2019,08,12),Date(2020,08,11)) // New calendar table
Start of year = Startofyear([Date], "08/11")
Endof year = Endofyear([Date], "08/11")
Start of month = eomonth([Date], -1) +12
End of month = eomonth([Date], 0) +11
Based on Start date month, year , you can create Rank and use that for Current Vs prior
Year Rank = RANKX(all('Date'),'Date'[Year Start date],,ASC,Dense)
Measure
This Year = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),h'Date'[Year Rank]=max('Date'[Year Rank])))
Last Year = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Year Rank]=max('Date'[Year Rank])-1))Power BI — Year on Year with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a
https://www.youtube.com/watch?v=km41KfM_0uAPower BI — Month on Month with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-mtd-questions-time-intelligence-3-5-64b0b4a4090e
https://www.youtube.com/watch?v=6LUBbvcxtKA