cancel
Showing results for
Did you mean:
Post Prodigy

## Year = year([Date]) How to modify to show last 5 year ?

Hi All

May i know how to modify the below expression :-

Year = year([Date])
So that it will only show last 5 year.

1 ACCEPTED SOLUTION
Super User III

Hi Paul,

Actually there's a better way.

In the Slicer, use Date from the Date Table in the Field and set it to only display the Year.

Then in your Filters use TopN filtering and drag Date from the Date Table into the By Value area and select to show the Latest Date, then set the filter to show the Top 5.

Regards

Phil

If I helped you, click on the Thumbs Up to give Kudos.

Proud to be a Super User!

7 REPLIES 7
Super User III

Try this

``Last 5 Years = FILTER(Year, YEAR(Date[Year]) >= 2018)``

Regards

Phil

If I helped you, click on the Thumbs Up to give Kudos.

Proud to be a Super User!

Post Prodigy
Super User IV

@admin11 , you can create a measure. Or user slicer

Or create a column to filter

FLag = if(year([Date]) >= year(Today()) -5, 1,0)

Proud to be a Super User!

Post Prodigy

Can you please share with me how to create expression for year , so when i use at Slicer , the Year filter will only display last 5 year.

Paul Yeo

Super User III

Hi Paul,

Actually there's a better way.

In the Slicer, use Date from the Date Table in the Field and set it to only display the Year.

Then in your Filters use TopN filtering and drag Date from the Date Table into the By Value area and select to show the Latest Date, then set the filter to show the Top 5.

Regards

Phil

If I helped you, click on the Thumbs Up to give Kudos.

Proud to be a Super User!

Post Prodigy

Now i start to understand that , need to make use of filter panel. thank you for sharing.

Paul

Post Prodigy

Your expression working fine. But i al looking for expression Year to display at every page user don't to tick 1 or 0.

@PhilipTreacy  approach is correct , but got error.

https://www.dropbox.com/s/11dzrqm4g56zqys/PBT_V2021_333%20year%20display%202020%202021.pbix?dl=0

Announcements