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

Help with MoM% change using date filter

I have a date filter on my dashboard, that is currently set at 1/1/2019(start) and 1/27/2020(end). I have a matrix with Mth-Yr in columns and data in each column. I am trying to calculate the % change in Jan 2020 to Dec 2020, but the problem is, there are only 27 days in the current month of Jan 2020. So what is the best way, or is there a way, to calculate MoM% change, given the date filter, to compare Jan 1-27 2020 to Dec 1-27 2019, instead of Dec 1-31 2019?

 

Thank you in advance

1 ACCEPTED SOLUTION

Accepted Solutions
cwnoll Frequent Visitor
Frequent Visitor

Re: Help with MoM% change using date filter

Thanks all for the quick responses, but I found a solution that works. I am using the following measure to accomplish this.

 

Trans MoM Var =
VAR __PREV_MONTH =
CALCULATE([Transport MTD],DATEADD(FILTER(DATESMTD('Calendar'[Date]),'Calendar'[Date]<TODAY()),-1,MONTH))
RETURN
    DIVIDE(SUM('TD'[Transport]) - __PREV_MONTH, __PREV_MONTH)

View solution in original post

3 REPLIES 3
Super User IV
Super User IV

Re: Help with MoM% change using date filter

Create a date calendar and following calculations should help, check for complete last month

 

MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD('Date'[Date]))
last MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-1,MONTH)))
last MTD (complete) Sales =  CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(ENDOFMONTH(dateadd('Date'[Date],-1,MONTH))))
last year MTD (complete) Sales =  CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(ENDOFMONTH(dateadd('Date'[Date],-12,MONTH))))

MTD (Year End) Sales =  CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(ENDOFYEAR('Date'[Date])))
MTD (Last Year End) Sales =  CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(ENDOFYEAR(dateadd('Date'[Date],-12,MONTH))))

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s.

Refer
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi

https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks. My Recent Blog -
Winner-Topper-on-Map-How-to-Color-States-on-a-Map-with-Winners , HR-Analytics-Active-Employee-Hire-and-Termination-trend
Power-BI-Working-with-Non-Standard-Time-Periods And Comparing-Data-Across-Date-Ranges

Connect on Linkedin

Super User III
Super User III

Re: Help with MoM% change using date filter

Hi @cwnoll,

 

does it really matter?

I mean do you also consider working days?

Or how do you compare February 2019 (28 Days) to March 2019 (31 Days)?

 

Perhaps you could consider the percentage progress of the month. (27/31 = 87%)

 

Regards,

Marcus

Dortmund - Germany
If I answered your question, please mark my post as solution, this will also help others.
Please give Kudos for support.

Did I answer your question?
Please mark my post as solution, this will also help others.
Please give Kudos for support.

Proud to be a Super User!

cwnoll Frequent Visitor
Frequent Visitor

Re: Help with MoM% change using date filter

Thanks all for the quick responses, but I found a solution that works. I am using the following measure to accomplish this.

 

Trans MoM Var =
VAR __PREV_MONTH =
CALCULATE([Transport MTD],DATEADD(FILTER(DATESMTD('Calendar'[Date]),'Calendar'[Date]<TODAY()),-1,MONTH))
RETURN
    DIVIDE(SUM('TD'[Transport]) - __PREV_MONTH, __PREV_MONTH)

View solution in original post

Helpful resources

Announcements
Exclusive LIVE Community Event #3 – Ask Arun Anything

Exclusive LIVE Community Event #3 – Ask Arun Anything

Join us in the third Triple A event!

Meet the 2020 Season 1 Power BI Super Users!

Meet the 2020 Season 1 Power BI Super Users!

It’s the start of a new Super User season! Learn all about the new Super Users and brand-new tiered recognition system.

January 2020 Community Highlights

January 2020 Community Highlights

Make sure you didn't miss any of the things that happened in the community in January!

Top Solution Authors
Top Kudoed Authors