Forum Discussion
Last 7 Days for Multiple Years
Hi,
I was wondering if there was a way to create a filter that displays "Last 7 Days" for multiple years.
so instead of just showing 2/8/2020-2/14/2020, it would show 2/8-2/14 for whichever years I choose....
Thank you!
Sarah
1 Reply
- amitchandak
Super User
If you have a date calendar then you can have year , 2year and so on behind measure, Typically same weekday i 364 days behind and same date is 1 year behind
Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-364,Days)) Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Year)) 2 Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-364*,Days)) 2 Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-2,Year))Use the relative date in Visual or page level filter to select 7 days.
or use :https://docs.microsoft.com/en-us/power-bi/visuals/desktop-slicer-filter-date-range
To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s.
Refer
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution.
In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blogs -Decoding Direct Query - Time Intelligence, Winner Coloring on MAP, HR Analytics, Power BI Working with Non-Standard TimeAnd Comparing Data Across Date Ranges
Connect on Linkedin