I have a dahsboard where I select year and charts are filtered based on the year selection. I have a line chart which is not linked to the slicer (interactions turned off) but I would like to display data related to 6 years prior to the date selected. Hence I thoght of creating a measure value that subtracts the selected year with the remaining years and apply that as a filter to my chart so I display values only where difference is 1,2,3,4,5 or 6.
0
votes
1 Answers
0
votes
You can create a measure to calculate the difference and use SELECTEDVALUE to get the year selected in the slicer. If we say, that you have a table named Table (Data)
with column Year
containing your data, and table named Table (Years)
with column Year
, which is your calendar table containing the list of years shown in the slicer, then the measure can be calculated like this:
Measure_Diff = SELECTEDVALUE('Table (Years)'[Year]) - MAX('Table (Data)'[Year])
Then you will get the number of years difference between the year in your data table and the one selected by the user: