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
Anonymous
Not applicable

YTD MTD mesures

Hi friends , actually i need to create a mesure to calculate total YTD sales also total MTD sales i used the folowing TotalSales = SUM (Table[Sales]) YTD_TotalSales = TOTALYTD([TotalSales];'Calendar'[Date]) but in my results YTD_TotalSales is have the same value then TotalSales in the previsous years 2018 , 2017 ... i need to see YTD_TotalSales for the same period as today date but in the previous years when i use year slicer Example : today 14 jan 2019 year TotalSales 15 000 $ YTD_TotalSales 2019 15 000 $ . (actual year ) 2018 .TotalSales 180 000$ YTD_TotalSales 13 750 $ 2017 TotalSales 177 000 $ YTD_TotalSales 13 200 $ i tried to change date form Calendar([Date]) to Salesdate([Date]) but no succes (same issue for MTD) i thhin that i should try a filter any help please .
1 ACCEPTED SOLUTION

Hi,

 

Try this

 

MTD sales = CALCULATE([TotalSales],DATESBETWEEN(Calendar[Date],DATE(YEAR(MIN(Calendar[Date])),MONTH(TODAY()),1),DATE(YEAR(MIN(Calendar[Date])),MONTH(TODAY()),DAY(TODAY()))))


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

View solution in original post

13 REPLIES 13
MFelix
Super User
Super User

Hi @Whiteanddark,

To get previous year sales ypu should use the folloing measure

Py YTD = TOTALYTD([TotalSales] ; DATEADD(Calendar[Date]; -1 ;YEAR))

Regards
MFelix

Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Anonymous
Not applicable

HI Felix thank you for the answer but the issue is not previsous total YTD i want to see YTD not equal to total sales it means if i choose 2017 on the slicer i should see Totalsales = sum of all sales in 2017 howerver TOTAL YTD will be the sales from start of the year till the same date of today but in 2017 ( 14 jan 2017 ) thanks

Hi,

 

Try this measure for YTD sales

 

YTD sales = CALCULATE([TotalSales],DATESBETWEEN(Calendar[Date],MIN(Calendar[Date]),DATE(YEAR(MIN(Calendar[Date])),MONTH(TODAY()),DAY(TODAY()))))

 

Select 2017 in the slicer.  The slicer should be built from the Calendar Table.


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

Works great 

thank you Ashish

You are welcome.  If my reply helped, please mark it as Answer.


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

of course Ashish just iam trying to calculate MTD with the same way can you help please ?

Hi,

 

I do not understand.  Please clarify.


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

i would like to calculate MTD so if i move the year slicer to the previous years  i will see the total month to date (totalsales) in the same day  like today 

Hi,

 

Try this

 

MTD sales = CALCULATE([TotalSales],DATESBETWEEN(Calendar[Date],DATE(YEAR(MIN(Calendar[Date])),MONTH(TODAY()),1),DATE(YEAR(MIN(Calendar[Date])),MONTH(TODAY()),DAY(TODAY()))))


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

well done ashish that works 

thank you so much

You are welcome.


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

Hi ashish 

i tried to calculate 

last mounth MTD 

MTD_Lm_TotalSales = calculate ([MTDtotalsales];PARALLELPERIOD('Calendar'[Date];-1;MONTH))

but it gives me the same results as MTD([TotalSales] 

Hi,

 

Try this

 

LM MTD sales = CALCULATE([TotalSales],DATESBETWEEN(Calendar[Date],DATE(YEAR(MIN(Calendar[Date])),MONTH(TODAY())-1,1),DATE(YEAR(MIN(Calendar[Date])),MONTH(TODAY())-1,DAY(TODAY()))))


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

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.