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

Regular Visitor

Dynamic MAX date

Hi everyone,

I need to limit the data that is being shown in a graph by following this criteria:

• If today is before the 15th of the current month, show up to the last day of two months ago
• If today is equal or after the 15th, show up to the last day of the previous month.

i.e: if we are one April 7th, show up to February 28th; after April 15th show up to March 31st and so on....

I think there are many ways to accomplish this, the aproach that I am trying to follow consists of a binary measure that determines the MAX date to show data depending on the current date. A few variables let me obtain dynamically the paramenters, however I am not sure how to proceed with the logic to determine the MAX date for each case.

VAR today_var = DATE(YEAR(TODAY()),MONTH(TODAY()),DAY(TODAY()))
VAR delay = DATE(YEAR(TODAY()),MONTH(TODAY()),15)
VAR maxDateBefore = EOMONTH(TODAY(), -2)
VAR maxDateAfter = EOMONTH(TODAY(), -1)

Perhaps that is not the best approach.

Any help is much appreciated, thanks in advance.

Regards

1 ACCEPTED SOLUTION
Super User

You use

``````VAR EndOfLastMonth =
EOMONTH ( TODAY (), -1 )
VAREndOfTwoMonthsAgo =
EOMONTH ( TODAY (), -2 )
IF ( DAY ( TODAY () ) >= 15, EndOfLastMonth, EndOfTwoMonthsAgo )``````
Super User

You use

``````VAR EndOfLastMonth =
EOMONTH ( TODAY (), -1 )
VAREndOfTwoMonthsAgo =
EOMONTH ( TODAY (), -2 )
IF ( DAY ( TODAY () ) >= 15, EndOfLastMonth, EndOfTwoMonthsAgo )``````

Announcements

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Power BI Monthly Update - July 2024

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

Fabric Community Update - July 2024

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

Top Solution Authors
Top Kudoed Authors