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
Anonymous
Not applicable

Default Slicer for Year Month

Hello All, I need your help in creating a default slicer Option: 

Scenario: I want to create a slicer which always selected latest yearmonth as Default selection (for example when user open report on September2019 he has to see 2019-sep as selected) and he also able to select previous yearmonth data.

Query Mode: IMPORT

Data I have is for 2017,2018, 2019 and I also have date column and yearmonth column(yyyy-mmm). So, I want to create a slicer with default latest yearmonth as selected and also users can select other years data if they want to.

I also don't want my users to see selection like Text 'latestyearmonth' they just have to see 2019-sep, 2019-Aug so on....

 

Help me resolve this..!!!

 

2 REPLIES 2
jdbuchanan71
Super User
Super User

@Anonymous 

I don't think there is a way to make the report default to "current month" without showing something like "current month" in the slicer.  It works this way because the filter from the slicer only sends the selection "current month" to the model.  The rows in the calendar table that are tagged as "current month" change when the month changes so the report follows the slicer.

If you can accept that then the column to add to your date table is something like.

Month Selection =
VAR TD =
    DATE ( YEAR ( TODAY () ), MONTH ( TODAY () ), 1 )
RETURN
    IF (
        DATE ( YEAR ( Dates[Date] ), MONTH ( Dates[Date] ), 1 ) = TD,
        "Current Month",
        FORMAT ( Dates[Date], "mmm-yyyy" )
    )
Anonymous
Not applicable

Thank you @jdbuchanan71 .But as per my requirement I want to label my field for present yearmonth as yyyy-mmm format not as "Current yearmonth"

Helpful resources

Announcements
July 2024 Power BI Update

Power BI Monthly Update - July 2024

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

July Newsletter

Fabric Community Update - July 2024

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