Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
D_PBI
Post Patron
Post Patron

How to have the last five years checked in a slicer visual as default but still show all the years?

Hi,
I have a slicer visual (vertical list) that contains each year in my model. It currently dates from 1960 to 2055 and so each year between those dates is available to check on the slicer.
Is there a way where I can check the boxes for the current year and four previous years (i.e. 2020 - 2024) but still have all the other years showing but just unchecked?  And as next year (2025) comes around, the slicer visual will default to checking only the years 2021-2025?
Thanks.


1 ACCEPTED SOLUTION
v-jialongy-msft
Community Support
Community Support

Hi @D_PBI 

 

I have carefully considered the method you envisioned, and found that it is not feasible, and I can provide you with an alternative method

 

First, I created the following table

vjialongymsft_0-1704248759193.png

 

 

You can then construct your slicer using the following calculated columns

 

IsSelectedYear =

IF(

    YEAR(TODAY()) - 'Table'[date].[Year] <= 4 && YEAR(TODAY()) - 'Table'[date].[Year] >= 0,

    "Selected",

    "Not Selected"

)

 

This formula can filter data from five years based on your current time

 

This is the result you want

vjialongymsft_1-1704248759195.png

 

 

 

 

Best Regards,

Jayleny

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
v-jialongy-msft
Community Support
Community Support

Hi @D_PBI 

 

I have carefully considered the method you envisioned, and found that it is not feasible, and I can provide you with an alternative method

 

First, I created the following table

vjialongymsft_0-1704248759193.png

 

 

You can then construct your slicer using the following calculated columns

 

IsSelectedYear =

IF(

    YEAR(TODAY()) - 'Table'[date].[Year] <= 4 && YEAR(TODAY()) - 'Table'[date].[Year] >= 0,

    "Selected",

    "Not Selected"

)

 

This formula can filter data from five years based on your current time

 

This is the result you want

vjialongymsft_1-1704248759195.png

 

 

 

 

Best Regards,

Jayleny

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-jialongy-msft - thank you for your efforts but that isn't the end result I was hoping for. I also need all the other years present in the slicer visual but just unchecked.

 Hi @D_PBI 

 

The PBIX file I provided contains unchecked years, but I used a filter to hide them, and if you want to show all the years just unchecked, you can also drag the year field into the slicer.

 

This is the result you want.

 

vjialongymsft_0-1704331824416.png

 

 

 

 

Best Regards,

Jayleny

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-jialongy-msft  Thanks for your follow up. Apologies, I didn't fully view your .pbix file the first time around. I see what you've done now. I guess by checking the 'Selected' parent chechbox, as each year turns the current year will automatically be checked as it falls within the 'Selected' year range.

lukiz84
Memorable Member
Memorable Member

not possible.

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.