Forum Discussion
Dynamic Date Shifting for Line chart Comparison
- 2 years ago
Hello Scott,
Thank you for the above information, I have a limitation with this measure, my events do not have a fixed number on the day shift.
So I used this method,1. Created a measure table named Date Shift,
with a columnsDate Shift = GENERATESERIES(-30, 30, 1)
Date Shift Value = SELECTEDVALUE('Date Shift'[Date Shift],0)
2. In the Date table, with the date column create another columnShifted Date = DATEADD('Date Table'[Date],'Date Shift'[Date Shift Value] -371,DAY)
3. In the DollarAmount Table, create Amount TY and Amount LY
Amount LY = CALCULATE(Sum('DollarAmount'[Amount]), DATEADD('Date Table'[Date], 'Date Shift Table'[Date Shift Value] -371 , DAY))4. Create Line Chart,
Add Date as X-axis
Amount TY and Amount LY as Y-axis
Shifted Date from Date Table as Tooltips
5. Add a slicer with a slider and add the Date Shift column from the Date Shift Table as a Field.
Your Line Chart with the Date Shift is ready.
This may not be an ideal solution to the problem, but it worked for me .
Hello Scott,
Thank you for the above information, I have a limitation with this measure, my events do not have a fixed number on the day shift.
So I used this method,
1. Created a measure table named Date Shift,
with a columns
Date Shift = GENERATESERIES(-30, 30, 1)
2. In the Date table, with the date column create another column
3. In the DollarAmount Table, create Amount TY and Amount LY
Amount LY = CALCULATE(Sum('DollarAmount'[Amount]), DATEADD('Date Table'[Date], 'Date Shift Table'[Date Shift Value] -371 , DAY))
4. Create Line Chart,
Add Date as X-axis
Amount TY and Amount LY as Y-axis
Shifted Date from Date Table as Tooltips
5. Add a slicer with a slider and add the Date Shift column from the Date Shift Table as a Field.
Your Line Chart with the Date Shift is ready.
This may not be an ideal solution to the problem, but it worked for me .