Forum Discussion
YTD Over Years
Hello everyone,
I have something like this today, it's a simples TOTALYTD measure. however what i want is the current YTD over years, for example:
however what i want is the current YTD over years, for example:
Today we are currently in 2024/09/05, i want to calculate sales from 2020/01/01 to 2020/09/05, 2021/01/01 to 2021/09/05 and so on.
The chart above is calculating the entire year over year. Is it possible create a measure that works as i need?
Thanks in advance
- Anonymous1 year ago
Hi All
Firstly Ashish_Mathur and lbendlin thank you for yours solutions!
And Mkobayashi ,As I understand it, you need to dynamically calculate each year's data to today's data based on the exact date of each day, right?
The data below is calculated using today's date as an example.YTD_by_Year = CALCULATE( SUM('sales_data_2020_2024'[Sales]), DATESYTD('sales_data_2020_2024'[Date],"12/31"), 'sales_data_2020_2024'[Date]<=DATE(YEAR('sales_data_2020_2024'[Date]),MONTH(TODAY()),DAY(TODAY())))YTD_by_2020 = CALCULATE(SUM(sales_data_2020_2024[Sales]),'sales_data_2020_2024'[Date]>=DATE(2020,1,1)&&'sales_data_2020_2024'[Date]<=DATE(2020,9,11))I hope my answer has helped you with your question, if you have any further questions you can always contact me and I will get back to you as soon as I see the message!
Hope it helps!
Best regards,
Community Support Team_ Tom ShenIf this post helps then please consider Accept it as the solution to help the other members find it more quickly.
4 Replies
- AnonymousNot applicable
Hi All
Firstly Ashish_Mathur and lbendlin thank you for yours solutions!
And Mkobayashi ,As I understand it, you need to dynamically calculate each year's data to today's data based on the exact date of each day, right?
The data below is calculated using today's date as an example.YTD_by_Year = CALCULATE( SUM('sales_data_2020_2024'[Sales]), DATESYTD('sales_data_2020_2024'[Date],"12/31"), 'sales_data_2020_2024'[Date]<=DATE(YEAR('sales_data_2020_2024'[Date]),MONTH(TODAY()),DAY(TODAY())))YTD_by_2020 = CALCULATE(SUM(sales_data_2020_2024[Sales]),'sales_data_2020_2024'[Date]>=DATE(2020,1,1)&&'sales_data_2020_2024'[Date]<=DATE(2020,9,11))I hope my answer has helped you with your question, if you have any further questions you can always contact me and I will get back to you as soon as I see the message!
Hope it helps!
Best regards,
Community Support Team_ Tom ShenIf this post helps then please consider Accept it as the solution to help the other members find it more quickly.
- MkobayashiNew Member
Hi Tom, thank you very much, that is what i needed!
- lbendlinSuper User
Add a filter that finds the current day of year and then limits the prior years to the same range. You can use a simple format string
FORMAT([date],"MMDD") <= FORMAT(TODAY(),"MMDD")
- Ashish_MathurSuper User
Hi,
Share some data to work with and show the expected result in a simple Table format. Share data in a format that can be pasted in an MS Excel file.