March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
I've followed the guide on https://radacad.com/previous-dynamic-period-dax-calculation for creating a dynamic previous period. So if I select a date range for the current period of;
However the StartOfPreviousPeriod measure is not ideal for me. For example, selecting a date range of 01/06/2019 to 30/06/2019 for the current period means that the StartOfPreviousPeriod is 02/05/2019, as in the example above.
StartOfPreviousPeriod = FIRSTDATE ( PREVIOUSDAY ( DATEADD ( CalendarCombined[Date], -1 * [DaysInCurrentPeriod], DAY ) ) )
However what I would like to do is have the date show as 01/05/2019 but I cannot figure out a way without breaking the dynamic elements of it. For clarity, using the examples supplied above if I select a date range for the current period of;
Any assistance would be greatly appreciated.
Solved! Go to Solution.
@mark_carlisle seems like you have two logic going on, and you want if selection is full month then use full previous month.
so you can build a logic like, if first selected date is first date of the month and last selected date is last date of the month, full month is selected and then use this in if condition with PreviousMonth DAX function.
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.
Yeah I figured that was going to be the case, was hoping there was going to be some time intelligence DAX function I might have missed. The following is what I've went with;
StartOfPreviousPeriod = IF ( AND ( FIRSTDATE ( CalendarCombined[Date] ) = STARTOFMONTH ( CalendarCombined[Date] ), LASTDATE ( CalendarCombined[Date] ) = ENDOFMONTH ( CalendarCombined[Date] ) ), FIRSTDATE ( PREVIOUSMONTH ( DATEADD ( CalendarCombined[Date], -1 * [MonthsInCurrentPeriod], MONTH ) ) ), FIRSTDATE ( PREVIOUSDAY ( DATEADD ( CalendarCombined[Date], -1 * [DaysInCurrentPeriod], DAY ) ) ) )
@mark_carlisle seems like you have two logic going on, and you want if selection is full month then use full previous month.
so you can build a logic like, if first selected date is first date of the month and last selected date is last date of the month, full month is selected and then use this in if condition with PreviousMonth DAX function.
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.
Yeah I figured that was going to be the case, was hoping there was going to be some time intelligence DAX function I might have missed. The following is what I've went with;
StartOfPreviousPeriod = IF ( AND ( FIRSTDATE ( CalendarCombined[Date] ) = STARTOFMONTH ( CalendarCombined[Date] ), LASTDATE ( CalendarCombined[Date] ) = ENDOFMONTH ( CalendarCombined[Date] ) ), FIRSTDATE ( PREVIOUSMONTH ( DATEADD ( CalendarCombined[Date], -1 * [MonthsInCurrentPeriod], MONTH ) ) ), FIRSTDATE ( PREVIOUSDAY ( DATEADD ( CalendarCombined[Date], -1 * [DaysInCurrentPeriod], DAY ) ) ) )
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
21 | |
14 | |
11 | |
8 | |
5 |
User | Count |
---|---|
24 | |
21 | |
20 | |
15 | |
10 |