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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
venu92
Frequent Visitor

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

@venu92 

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

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
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.