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
ebeauchamp
Helper I
Helper I

Compare Month to Date sales with Previous Month to Date sales - on a daily basis

Hi everyone,

 

I am trying to build a visual table where the columns will be:
YearMonth  Amount   MTD   PreviousMTD   Variation between MTD/PMTD

There are daily transactions coming in. The goal is to be able to compare, on a same day of the month, the overall variation and see how it evolves on a daily basis. Eg. compare the MTD on Dec 10, vs. what was the MTD on Nov 10, Oct, 10 and so on.

Looking at different posts I am able to correctly get the MTD with this measure:

MTD = CALCULATE(SUM(Orders[Amount]), FILTER(Dates, Dates[Date] >= DATE(YEAR(Dates[Date]), MONTH(Dates[Date]), 01)), FILTER(Dates, Dates[Date] < DATE(YEAR(Dates[Date]), MONTH(Dates[Date]), DAY(TODAY()))))

However I just can't figure how to create a different one (say PMTD) to indicate Month - 1, and then to do a simple calculation of variance between MTD and PMTD.

Thanks in advance for your help!
Erik

1 ACCEPTED SOLUTION

Hi @mwegener ,

Thanks so much for the quick and detailed answers, really appreciated! I was actually able to make it work by using your PMTD measure, but combined with my original MTD measure as in the original post. So the measure looks like this:

PMTD = CALCULATE([MTD], DATEADD(Dates[Date],-1,MONTH )) 
 

So as a result, it's now possible to show in the same table the total amount, the MTD, the PMTD, and the variance between the two.  Screen capture below. This way, on each day of the month, you can see how you're trending vs. the same day last month.

 

Table.jpg

View solution in original post

4 REPLIES 4

Hi @ebeauchamp ,

 

check this out.

 

MTD = 
TOTALMTD(SUM(Orders[Amount]), Dates[Date])
PMTD = 
TOTALMTD(SUM(Orders[Amount]), DATEADD(Dates[Date],-1,MONTH))

 

 

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


Hi @mwegener ,

Thanks so much for the quick and detailed answers, really appreciated! I was actually able to make it work by using your PMTD measure, but combined with my original MTD measure as in the original post. So the measure looks like this:

PMTD = CALCULATE([MTD], DATEADD(Dates[Date],-1,MONTH )) 
 

So as a result, it's now possible to show in the same table the total amount, the MTD, the PMTD, and the variance between the two.  Screen capture below. This way, on each day of the month, you can see how you're trending vs. the same day last month.

 

Table.jpg

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


Hi @ebeauchamp ,

 

1. Take a look at the Quickmeasure MTD

https://docs.microsoft.com/en-us/power-bi/desktop-quick-measures

2. Take a look at relative date slicer and filter, to filter the visual on today

https://docs.microsoft.com/en-us/power-bi/visuals/desktop-slicer-filter-date-range

3. Take a look at PARALLELPERIOD DAX Funktion
https://docs.microsoft.com/en-us/dax/parallelperiod-function-dax

 

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


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.