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

The Fabric Community site will be in read-only mode on Monday, Feb 24 from 12:01 AM to 8 AM PST for scheduled upgrades.

Reply
Sarah_
Frequent Visitor

Sum a Running Total

Hi, 

I am trying to get a running 3 year total that then also sums for the quarter. 

 

So what I want is something like this - Where I can calculate a running total, and then sum that total on a quarterly basis. 

Sarah__1-1669150528460.png

 

I found the below solution for creating a 3 year running total on a monthly basis, but that measure doesn't get summed for the quarter. The value displayed for the quarter is the exact same as the month. Any ideas why my running total won't sum? Thank you!

 

Sarah__0-1669150507760.png

 

15 REPLIES 15
Thennarasu_R
Responsive Resident
Responsive Resident

@Sarah_ 
Try This measure,

Measure = CALCULATE ([Test1],
FILTER (
ALLSELECTED'Calendar_New'),
'Calendar_New'[sortyearmonth]<=MAX('Calendar_New'[sortyearmonth])
&& 'Calendar_New'[FY_Year] = MAX ('Calendar_New'[FY_Year])
)
)

Thanks
Thennarasu
 

Thanks Thennarasu! I tried a modified version - I couldn't figure out how the [sortyearmonth] and [FY_Year] portions of the formula were working so I went with this - 

 

3 Year Running Total =
CALCULATE(SUM(Sheet1[Quantity]),
FILTER(ALLSELECTED(Sheet1[Calendar Date]),
Sheet1[Calendar Date] > MAX(Sheet1[Calendar Date])-1080 &&
Sheet1[Calendar Date] <= MAX(Sheet1[Calendar Date])))
 
It gives me the same result where I get a monthly running total, but it doesn't sum the values for the quarter. 
amitchandak
Super User
Super User

@Sarah_ , You can get qtr value with help from date tbale and time intellignece , same for all month in qtr

 

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

 

or

 

This Qtr=
var _max1 = today()
var _min = eomonth(_max1,-1* if( mod(Month(_max1),3) =0,3,mod(Month(_max1),3)))+1
var _max= eomonth(_min, 2)
return
if('Date'[Date]>= _min && 'Date'[Date] <= _max , "Latest Qtr" format([Date], "YYYY-QQ") )

 

 

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

I am so appreciative of your help! But I need to do more than QTD sales. I have a 3 year running total by month, and want the quarter to be the sum of the 3 months' running value. So if Oct running total value is 50, Nov has sales of 10 which makes a running total of 60, and Dec again has sales of 10 so the running total is 70, then I want the Q4 total to = 50+60+70. But I can't sum the running total. It just gives the last month total. 

Hi,

Share some data to work with and show the expected result very clearly.


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

Hi Ashish, 

 

I created an excel file with fake data to send, but I can't seem to upload it. Below is a new screenshot using the fake data, along with a description of what I see vs what I want to see. 

Sarah__0-1669175173371.png

Here is the formula I am using for the 3 year running total:

 

3 Year Running Total =
CALCULATE(SUM(Sheet1[Quantity]),
FILTER(ALLEXCEPT(Sheet1,Sheet1[Description Detail]),
Sheet1[Calendar Date] > MAX(Sheet1[Calendar Date])-1080 &&
Sheet1[Calendar Date] <= MAX(Sheet1[Calendar Date])))
 
Is there a way to upload an excel file here?
 
Thank you!

Upload the file to Google Drive and share the download link.


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

Test File 

 

Here's the data!

Hi,

In another tab of that Excel workbook, please show the expected result.  The image you posted earlier is very small so I cannot understand what youw want.


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

Apologies for the delayed response - I just put a picture of the desired result in the second tab of the data sheet. Thank you! 

 

Pasting the screenshot in another tab of the Excel workbook just does not help.  How have you derivd the figures in column C of the PBI screenshot worksheet?  Explain that.


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

In the screenshot I'm trying to show what I am getting vs what I want. 

 

I am able to acheive a monthly 3-year running total using the following formula:

 

3 Year Running Total =
CALCULATE(SUM(Sheet1[Quantity]),
FILTER(ALLEXCEPT(Sheet1,Sheet1[Description Detail]),
Sheet1[Calendar Date] > MAX(Sheet1[Calendar Date])-1080 &&
Sheet1[Calendar Date] <= MAX(Sheet1[Calendar Date])))
 
So the running total by month is just fine. However, the running total is not accurate on a quarterly basis. So in the screenshot, Columns C and F are the same value even though Column C is for the month and Column F is for the quarter. In Column G I typed what I actually want Column F to show. Since Column F is a quarterly number, it should be summing the results of the 3 year running total for the quarter. 
 
Thanks!

I am not interested in seing your formula - I'll write my own.  To receive any further help from me, please answer the question that i have asked in my prevous message.


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

I'm really sorry, I thought I was answering your questions. I'm very grateful for the help. Could you maybe re-phrase the question as I clearly didn't understand. I thought you were asking me about data in the screenshot that appeared in Column C, which was from the formula I created. What should I be clarifying instead? 

Please show which MS Excel formula you would have written to calculate the numbers in clumn C of the PBI screenshot worksheet.  Show the formula in the cells of that column.


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

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Feb2025 NL Carousel

Fabric Community Update - February 2025

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