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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

Need Help With Monthly Total Vs YTD

Hello All,

I have a data set from an access date base that looks like the follow:

Month                                                   Total Monthly X
11/14/2019                                              28
1/14/2020                                                21

This data is also linked to a datetable that I created for time intelliengence related Calculations. What I am seeking to show is the monthly total and YTD. I have set up FY and Month Name as filters, so forexample if I place this in a card visual it should look like this when I filter by Month name and FY:

Month           YTD
21                  49

The challenge i have is that When I place the total monthlyX in card visual, it gives me the same values for both Month Total and YTD such as 49 for both.

 

Any ideas on how to correct this.

 

Thanks all for your help

11 REPLIES 11
v-juanli-msft
Community Support
Community Support

Hi @Anonymous 

so forexample if I place this in a card visual it should look like this when I filter by Month name and FY:

Month           YTD
21                  49

 

which items do you select from the slicer?

Is the YTD is from the start of year 2019 to the max date in the table?

Or YTD is the start date of 2019 and the end date(2019/12/31) of 2019?

 

Best Regards

Maggie

amitchandak
Super User
Super User

If you are still facing the issue. Please find some formula's that can help

 

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),"8/31")))
Rolling 3 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],ENDOFMONTH(Sales[Sales Date]),-3,MONTH)) 
3 month back MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-3,MONTH)))
 


QTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESQTD(('Date'[Date])))

Last QTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESQTD(dateadd('Date'[Date],-1,QUARTER)))
Next QTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESQTD(dateadd('Date'[Date],1,QUARTER)))

Last year same QTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESQTD(dateadd('Date'[Date],-1,Year)))



YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(('Date'[Date]),"3/31"))

Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"3/31"))
Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(ENDOFYEAR(dateadd('Date'[Date],-1,Year)),"3/31"))

Last to last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-2,Year),"12/31"))

Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Year))
2 Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-1,Year))

Cumm Sales = CALCULATE(SUM(Sales[Sales Amount]),filter(sales,sales[date] <=maxx(date,date[date])))

Rolling 12 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],ENDOFMONTH(Sales[Sales Date]),-12,MONTH))  
Rolling last 12 before 12 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],ENDOFMONTH(dateadd('Date'[Date],-12,MONTH)),-12,MONTH))  


Rolling 30 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],maxx(sales,Sales[Sales Date]),-30,DAY))   
Rolling last 30 before 30 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],(dateadd('Date'[Date],-30,DAY)),-30,DAY))  

 

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

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
VasTg
Memorable Member
Memorable Member

@Anonymous 

 

What is the DAX that you used for  YTD measure?

 

Refer to documentation for TOTALYTD.

https://docs.microsoft.com/en-us/dax/totalytd-function-dax

 

If this helps, mark it as a solution.

Kudos are nice too

Connect on LinkedIn
Anonymous
Not applicable

@VasTg ,

 

This is the YTD formula I used: 

 

@Anonymous 

 

Based on the input data you should get 21 for 2020. Could you please post sample data and DAX you used to calculate the YTD and monthly measure and the expected output to better answer your question?

 

 

Connect on LinkedIn
Anonymous
Not applicable

@VasTg  Many thanks fro your help thus far.

 

Those are the only two pieces of information in the data as previoulsy posted. I picked the monthly total from the main table since its already aggregated(value).

YTD dax is as follows: Calculate(Sum(Tablename[monthly value]),Filter(All(Datetable[date]),datetable[date]<=Max(Datetable[Date])).

Expected output when FY and Monthname is applied:

Month                YTD
21                          49

@Anonymous 

 

You stated the problem is with Month value is not showing for the correct month. I tested with your input data and I see the correct value. Could you upload your PBIX file to check what the error is.

 

Cap11.PNG

 

If it helps, mark it as a solution

Kudos are nice too.

Connect on LinkedIn
Anonymous
Not applicable

@VasTg ,

 

Did you link it to a datetable? I have my data set up to a datetable. Due to the privacy of the data model, I cannot my pbix. However, I have reviewed your sample but i see you have Calendar year. I have a FY starting from Jul-Jun. And somehow when I place the total monthly into the cad visual, it automatically adds both months just as the YTD.

 

 

@Anonymous 

 

I have a relationship between the date and fact based on the date column.

 

Of course it will add when you choose FY. You should filter for month.

Connect on LinkedIn
Anonymous
Not applicable

@VasTg ,

 

I did filter for month but they both remain the same 49.

 

I amnot sure why this is going on

Anonymous
Not applicable

@VasTg Can you share your pbix file to compare with mine.

 

I ahve tried different formulas to no avail.

 

Thanks

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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