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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Pbi07
Helper V
Helper V

MTD Total, Previous Day and Current Date Total

Hello 

 

I am trying to get the MTD Total along with the Total for previous day and total for Today for a simple fact table with Order Quantity. 

 

The user would like to look at this report daily.

I was thinking of using the slicer with the calendar Month. 

I tried using the DATEADD function with -1 for Yesterday total and with 0 for today, but gave an error when i try adding that to the visual. Is there a different way to achieve this? My model is attached. 

 

Prior Day Orders = CALCULATE(SUM(Orders[Quantity]),DATEADD('Calendar'[Date],-1,DAY))
 

Expected result is 

CustomerMTD TotalYesterday TotalToday TotalDifference
100270012000-1200
1012000   
     

 

https://drive.google.com/file/d/1neGxPlFQPQI3O9BFSfwXvCStw5F4sREO/view?usp=sharing

 

2 ACCEPTED SOLUTIONS
Ashish_Mathur
Super User
Super User

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

Hi,

Modify your Calendar to start from April 1 2020 and then this measure will work

Total MTD orders in SPLY = CALCULATE([Total orders],DATESBETWEEN('Calendar'[Date],EOMONTH(MIN('Calendar'[Date]),-13)+1,EDATE(MIN('Calendar'[Date]),-12)))

Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

6 REPLIES 6
Ashish_Mathur
Super User
Super User

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Thanks @Ashish_Mathur . 

 

With the 3 slicers - Year, Month & date  i tried to add the previous year MTD value and did not show the values for April 2020 even though the fact had an order qty of April 2020 for 1500. Anything that i am doing wrong? 

MTD LY Orders = TOTALMTD([Total orders],SAMEPERIODLASTYEAR('Calendar'[Date]))
 

 

Hi,

Modify your Calendar to start from April 1 2020 and then this measure will work

Total MTD orders in SPLY = CALCULATE([Total orders],DATESBETWEEN('Calendar'[Date],EOMONTH(MIN('Calendar'[Date]),-13)+1,EDATE(MIN('Calendar'[Date]),-12)))

Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Thanks @Ashish_Mathur 

 

When i try to apply this in to the actual model i am getting incorrect  Last Year MTD totals. 

The calendar is from May 2018. Not a calendar issue. 

1. When i keep the 3 slicers, the last Year MTD measure is incorrect

2. When i keep Year and Month slicer and remove the date slicer the measure total is correct. but the previous day and the current day goes away as it is tied to the date

 

I tried with 2 measures and 

TEST 1 MTD LY = 

CALCULATE(SUM(Orders[Sales Qty]),DATESBETWEEN('Calendar'[Date],EOMONTH(MIN('Calendar'[Date]),-13)+1,EDATE(MIN('Calendar'[Date]),-12)))
TEST 2 MTD LY = TOTALMTD(SUM(Orders[Sales Qty]),SAMEPERIODLASTYEAR('Calendar'[Date]))

Hi,

First of all, let me know which slicers do you wan to keep - Year, Month and Days or only Year and Month?  Share the link from where i can download your revised file with Dates from 2018.  Clearly show the wrong result and also show me the exact result that you are expecting.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Thanks @Ashish_Mathur 

 

I will try with only the date slicer as requirement is to pick any date. 

I could not replicate that last year MTD issue in to this smaller model. I will find out. I am sure i am messing something up in that meaure. Thanks for your help. 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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