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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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" ... 


@ 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.


@ 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" ... 


@ 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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.