cancel
Showing results 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

Post Partisan

## 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
Super User

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

Super User

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

Super User

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

Post Partisan

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)