Forum Discussion
Slicer to Add Lag Time to Graph
Hey guys, just wondering if I can add in a slicer that will allow my users to move a series in a graph by X number of days (or time units) to see how it aligns with the other series. For example, if my graph looks like this raw:
is it possile to add a slicer that will allow them to choose "20" as a lag, which then shifts the red series by 20 units to the right?
1 Reply
- bhanu_gautam
Super User
zacharylwy , Yes you can use Parameters for this
Create a Parameter Table: Create a table that contains the possible lag values (e.g., 0, 1, 2, ..., 20). This table will be used for the slicer.
Create a DAX measure that shifts the series based on the selected lag value from the slicer. This measure will use the SELECTEDVALUE function to get the chosen lag value and then adjust the series accordingly
DAX
SelectedLag = SELECTEDVALUE(LagTable[Lag], 0)ShiftedSeries =
VAR LagValue = [SelectedLag]
RETURN
CALCULATE(
SUM(YourTable[YourSeries]),
DATEADD(YourTable[Date], LagValue, DAY)
)Use the new measure in your visual to display the shifted series.