Forum Discussion
Default selected value in date slicer
I have a slicer that presents year-month (from my date table).
I want the slicer to be default filtered (selection) on the current month, but the user need to be able to select other months as well.
There is a column CurrentMonth (yes/no) in the date table that might help me?
5 Replies
- selimovd
Most Valuable Professional
Hey Anonymous ,
yes, you can add a calculated column that is checking for the current month. This you can activate as a slicer.
Check the following article on how to do that:
If you need any help please let me know.If I answered your question I would be happy if you could mark my post as a solution โ๏ธ and give it a thumbs up ๐Best regardsDenisBlog: WhatTheFact.biFollow me: twitter.com/DenSelimovic- AnonymousNot applicable
Not sure if it works
I have two slicers below, one for yearmonth and one for the IsPreviousMonth flag (see screenshot)
The values are in swedish (2021 juli means 2021 july and Ja/Nej means Yes/No).
When the IsPreviousMonth = yes is selected the YearMonth slicer is filtered but the value is not selected.
Apart from that I also want the user to see all values for YearMonth
- v-luwang-msft
Community Support
Hi Anonymous ,
By the picture you provided,try the below steps:
Then the Slicer Yearmon is not affected by Slicer mon.
And I think you could try the following soultion:
create a new measuere:
values2 = var test1= CALCULATE ( MAX ( 'Table'[value] ), FILTER ( 'Table' , month('Table'[date])=MONTH(NOW())-1&&YEAR('Table'[date])=YEAR(NOW())) ) var test2= CALCULATE ( MAX ( 'Table'[value] ), FILTER ( 'Table' , 'Table'[yearmon] = SELECTEDVALUE ( 'Table'[yearmon] ) ) ) return IF( ISFILTERED( 'Table'[yearmon]) = True() , test2,test1)then create visual ,the visual default to last month's data when the slicer is not selected.
Wish it is helpful for you!
Best Regards
Lucien
- AnonymousNot applicable
Thanks, that will certainly work but there are many (more than 30) measures that needs to be adjusted.
- v-luwang-msft
Community Support
HI Anonymous ,
Has your problem been solved, if so, please consider Accept a correct reply as the solution or share your own better solution to help others find it.
Best Regards
Lucien