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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
Anonymous
Not applicable

In between Date slicer to show previous month [from current date] dates

Hi,

I need 2 Date slicers [in between] : [Today is Sept 18, 2023]

1. The first slicer to show Previous months dates. the Date slicer edges should point at August 1  and August 31.

2. second date slicer should show June 1 2023 to current date: so, the slicer edges should point  at June 1 and Sept 18.

 

Could you please suggest how to do it. Thanks.

4 REPLIES 4
parry2k
Super User
Super User

@Anonymous Although looked closely there is a challenge with the way you solved the 2nd slicer, think if you are in Jan 2024, the end date will be Jan 2024 and the start date will be Jun 2024, and you will not get anything. You need to update it like this:

 

VAR _CurYear = YEAR(TODAY())
VAR _StartDate = MIN(DATE( _CurYear,6,1), TODAY () )

RETURN
CALENDAR(_StartDate, TODAY())

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

parry2k
Super User
Super User

@Anonymous perfect, I was not sure why you have Jun 2023 as the start date but you got the point on how to solve it.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

parry2k
Super User
Super User

@Anonymous not sure but you can add two tables using following DAX expression:

 

Slicer 1 = 
VAR __Today = TODAY ()
VAR __EndDate = EOMONTH ( __Today, -1 ) 
VAR __StartDate = EMONTH ( __Today, -2 ) + 1
RETURN
CALENDAR ( __startDate, __EndDate )

Slicer 2 =
VAR __EndDate = TODAY ()
VAR __StartDate = DATE ( 2023, 6, 1 )
RETURN
CALENDAR ( __StartDate, __EndDate )


Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

Thanks a lot @parry2k for your prompt response. 🙂

I did lil update to 2nd date slicer code as user wants the slicer's right edge to point to last day of previous month

VAR _CurYear = YEAR(TODAY())

VAR _EndDate = EOMONTH(TODAY(), -1)

VAR _StartDate = DATE( _CurYear,6,1)

RETURN

CALENDAR(_StartDate, _EndDate)

 

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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