Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
cwnoll
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
cwnoll
Frequent Visitor

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
cwnoll
Frequent Visitor

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)

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.

Marcus Wegener works as Full Stack Power BI Engineer at BI or DIE.
His mission is clear: "Get the most out of data, with Power BI."
twitter - LinkedIn - YouTube - website - podcast


amitchandak
Super User
Super User

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

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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