Forum Discussion
Question about Power Bi
Hi everyone.
I am working on a chart with data that ranges from January 1 2015 to present. I am trying to showcase a specific time frame from March 15 2019 to present vs March 15 2020 to present - and I am also filtering by specific info in the dataset.
While I can filter by year and month...if i add dates it filters for the days I select for all the months. Since I am filtering from March 15 to present, choosing the days has an impact.
Any ideas?
Hi Anonymous,
Create 1 separate date table,use the date as slicer to specificy two parallel dates over two different years.
Then create 2 different measures such as below:
Measure add 3 month = var _dateadd=DATEADD('Table 2'[Date],3,MONTH) Return CALCULATE(SUM('Table'[Value]),FILTER('Table','Table'[Date]>=SELECTEDVALUE('Table 2'[Date])&&'Table'[Date]<=_dateadd))Measure add 5 month = var _dateadd=DATEADD('Table 2'[Date],5,MONTH) Return CALCULATE(SUM('Table'[Value]),FILTER('Table','Table'[Date]>=SELECTEDVALUE('Table 2'[Date])&&'Table'[Date]<=_dateadd))And you will see:
I made a sample .pbix file,pls see attached.
Best Regards,
KellyDid I answer your question? Mark my post as a solution!
3 Replies
- amitchandakSuper User
Anonymous , Not very clear. You can use the Date Range filter?
- AnonymousNot applicable
I do have the data range filter but it does not allow me to specificy two parallel dates over two different years. I am attempting to use a clustered chart with totals displayed for 2019 (as one bar) and 2020 as another. By simply using a date range it calculates the total from 2019 March 15 to present. I need each bar to be March 15 , 2019 until Jul 17, 2019. March 15, 2020 until July 17, 2020. As each day passes the totals should reflect from March 2015 to the current date (i.e. today) and the same for 2019.
- v-kelly-msftCommunity Support
Hi Anonymous,
Create 1 separate date table,use the date as slicer to specificy two parallel dates over two different years.
Then create 2 different measures such as below:
Measure add 3 month = var _dateadd=DATEADD('Table 2'[Date],3,MONTH) Return CALCULATE(SUM('Table'[Value]),FILTER('Table','Table'[Date]>=SELECTEDVALUE('Table 2'[Date])&&'Table'[Date]<=_dateadd))Measure add 5 month = var _dateadd=DATEADD('Table 2'[Date],5,MONTH) Return CALCULATE(SUM('Table'[Value]),FILTER('Table','Table'[Date]>=SELECTEDVALUE('Table 2'[Date])&&'Table'[Date]<=_dateadd))And you will see:
I made a sample .pbix file,pls see attached.
Best Regards,
KellyDid I answer your question? Mark my post as a solution!