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
JoSwinnen
Helper I
Helper I

Show the current month by default and the latest N months

Hi, 

 

I'm trying to find a solution where I have two slicers: year and month. I find a lot of different solutions on the forum. When I open Power BI, I want to show by default the current year and the current month. I saw already a lot of posts about this, but they are a couple of years old, I don't know whether there is a recent solution for this?

 

But I also want to create a third slicer where you can select how many months are shown in the visualisations. For instance I have a line graph with on the x axis the months and it shows the sales. 

So in the slicer month it says current month, but in the third slicer I want to select how many months to show in the past: 5, 12, 25, ... 

 

Thanks a lot,

 

Jo 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@JoSwinnen , Still you have to use a workaround only m to have columns like this year and this month

 

Is This Year = if('Date'[Date]>=date(Year(TODAY()),1,1) && 'Date'[Date]<=TODAY(),"This year",[Date]&"")

 

Month Type = Switch( True(),
Date([Date]) = eomonth(Today(),-1),"Last Month" ,
Date([Date])= eomonth(Today(),0),"This Month" ,
[Month]
)

 

and you need save on this year and this month

Default Date Today/ This Month / This Year: https://www.youtube.com/watch?v=hfn05preQYA

View solution in original post

2 REPLIES 2
JoSwinnen
Helper I
Helper I

Thanks! It works. 

amitchandak
Super User
Super User

@JoSwinnen , Still you have to use a workaround only m to have columns like this year and this month

 

Is This Year = if('Date'[Date]>=date(Year(TODAY()),1,1) && 'Date'[Date]<=TODAY(),"This year",[Date]&"")

 

Month Type = Switch( True(),
Date([Date]) = eomonth(Today(),-1),"Last Month" ,
Date([Date])= eomonth(Today(),0),"This Month" ,
[Month]
)

 

and you need save on this year and this month

Default Date Today/ This Month / This Year: https://www.youtube.com/watch?v=hfn05preQYA

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.

Top Solution Authors