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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
magji
Helper I
Helper I

Slicer default selection based on date

I have created a report where it has a slicer Reporting Period, period updates every month with current month.
Is there any way that changes default selection value based on current month because right now the slicer selection stays just like it was in the moment where it was saved and published.

1 ACCEPTED SOLUTION

@magji Right, so the "something else" is whatever you want, so for example:

Column =
  VAR __Year = YEAR(TODAY())
  VAR __Month = MONTH(TODAY())
  VAR __Date = [Date]
RETURN
  IF(YEAR(__Date) = __Year && MONTH(__Date) = __Month,"Current Month",FORMAT(__Date,"mmmm") & YEAR(__Date))

So, this will return "Current Month", "August 2020", "July 2020" ... 


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

3 REPLIES 3
Greg_Deckler
Super User
Super User

@magji Not great way of doing it. You can use a relative date slicer. Or you can create a "flag" column that evaluates to "Current Month" and "Something else" for example and then you set "Current Month" in a slicer based on this column.


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler 
Thank you, but the user must be still able to select the previous months.
When the user opens the report in Power Bi they want the slicer automatically be selected in current month.

@magji Right, so the "something else" is whatever you want, so for example:

Column =
  VAR __Year = YEAR(TODAY())
  VAR __Month = MONTH(TODAY())
  VAR __Date = [Date]
RETURN
  IF(YEAR(__Date) = __Year && MONTH(__Date) = __Month,"Current Month",FORMAT(__Date,"mmmm") & YEAR(__Date))

So, this will return "Current Month", "August 2020", "July 2020" ... 


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

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.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

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