Forum Discussion
Anonymous
6 years agoNot applicable
Values shown on wrong date
Hi, I am fairly new to Power BI and here is something that I cannot solve on my own right now. I have a report where I want to show a dynamic axis for the timeframe that is selected by the user (...
amitchandak
6 years agoSuper User
You have to make sure, your date, month year on axis comes from the date table.
you can use trailing year
Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Year))
YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(('Date'[Date]),"12/31"))
This Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD((ENDOFYEAR('Date'[Date])),"12/31"))
Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))
Last YTD complete Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR(dateadd('Date'[Date],-1,Year)),"12/31"))
Last to last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-2,Year),"12/31"))
This file has few such example https://www.dropbox.com/s/bu47m5ek7sr9v8t/sales_analytics_v2.pbix?dl=0
- Anonymous6 years agoNot applicable
amitchandak First of all, thank you for your quick response! But when I do what you suggested (change the axis to a field of the Calendar table) then I will not have a dynamic axis. What can I do to make my axis dynamic based on the slicer selection by the user?
- amitchandak6 years agoSuper User
Anonymous, I think for the measure you can use Slicer, bit for axis I think you have to use the bookmark
https://radacad.com/bookmarks-and-buttons-making-power-bi-charts-even-more-interactive