cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
philtab Frequent Visitor
Frequent Visitor

Add 3 Month to MIN Date

Hi all,

 

I have an issue with my DAX formula. 

I want to compare to dates in a matrix using a dates filter (Quarters and Year):Quarters.png

 I almost solved this by using the following two formulas.

First date (e.g. Q1 2017):

Min_Value = CALCULATE(SUM('Totals'[Value])|FILTER(ALL('Date'[Date])|'Date'[Date] <= MIN('Date'[Date])))

Second date (e.g. Q1 2018):

Max_Value = CALCULATE(SUM('Totals'[Value])|DATESYTD('Date'[Date]))

 

 

But with the formula for the first date I have the issue that I get the values for the beginning of the quarter but I want to have the values for the end of the quarter. 

If I add 90 days to the MIN Date I get roughly what I am looking for but of course this isn't accurate:

Min_Value = CALCULATE(SUM('Totals'[Value])|FILTER(ALL('Date'[Date])|'Date'[Date] <= MIN('Date'[Date])+90))

 

Is there a way that I can add 3 month to the MIN date which would give me the accurate result?

 

Many thanks in advance.

 

Philip

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Add 3 Month to MIN Date

Hi,

 

Not sure of what you want but try this

 

Min_value = CALCULATE(SUM('Totals'[Value]),DATESBETWEEN('Date'[Date],EDATE(MIN('Date'[Date]),3),EDATE(MIN('Date'[Date]),3)))

 

Hope this helps.

View solution in original post

4 REPLIES 4
Super User
Super User

Re: Add 3 Month to MIN Date

I’m not 100% clear what you are trying to do.  The trick with these things is to have an ID column for the granularity you are trying to time shift. So if you want to time shift months, then create a unique month ID. Have a read of my article here for a more complete explanation. https://exceleratorbi.com.au/dax-time-intelligence-beginners/



* Matt is a Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
Super User
Super User

Re: Add 3 Month to MIN Date

Hi,

 

Not sure of what you want but try this

 

Min_value = CALCULATE(SUM('Totals'[Value]),DATESBETWEEN('Date'[Date],EDATE(MIN('Date'[Date]),3),EDATE(MIN('Date'[Date]),3)))

 

Hope this helps.

View solution in original post

Highlighted
philtab Frequent Visitor
Frequent Visitor

Re: Add 3 Month to MIN Date

Thanks a lot! That solved my problem!

Super User
Super User

Re: Add 3 Month to MIN Date

You are welcome.

Helpful resources

Announcements
Can You Solve These Challenge

Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

Community News & Announcements

Community News & Announcements

Get your latest community news and announcements.

Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Community Kudopalooza

Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Users Online
Currently online: 249 members 2,417 guests
Please welcome our newest community members: