Forum Discussion
Plot showing 2-year evolution using year filter as reference date
- 5 years ago
You can create a disconnected table which contains all the years in a column. Then create below measures.
Selected Year = SELECTEDVALUE(Years[Year]) Flag = IF(SELECTEDVALUE('Date'[Year])<=[Selected Year]&&SELECTEDVALUE('Date'[Year])>=[Selected Year]-2,1,0)Put the Year column from Years table into a slicer for users to pick a year. Put the Flag measure into the visuals' filter pane as a visual-level filter and set show items when value is 1 and apply the filter. You need to have a column from Date table in the same visual to provide a context for the measure.
Attached a sample file for your reference.
Regards,
Community Support Team _ Jing
If this post helps, please Accept it as the solution to help other members find it.
You can create a disconnected table which contains all the years in a column. Then create below measures.
Selected Year = SELECTEDVALUE(Years[Year])
Flag = IF(SELECTEDVALUE('Date'[Year])<=[Selected Year]&&SELECTEDVALUE('Date'[Year])>=[Selected Year]-2,1,0)
Put the Year column from Years table into a slicer for users to pick a year. Put the Flag measure into the visuals' filter pane as a visual-level filter and set show items when value is 1 and apply the filter. You need to have a column from Date table in the same visual to provide a context for the measure.
Attached a sample file for your reference.
Regards,
Community Support Team _ Jing
If this post helps, please Accept it as the solution to help other members find it.
My problem came to the fact that when having the Calendar table related to the data table, when filtering by the year it always showed the data limited to that year, and not with the previous two. If there is no relationship between both tables, then it works perfectly, showing the data defined in that time range set in the measure.
- v-jingzhang5 years agoCommunity Support
Yes, that's why we need a new disconnected table to hold year values. The Years table is specially created for the slicer.