YTD Calculations by User/Month

DBB1

New Member
Joined
Mar 28, 2023
Messages
10
Office Version
  1. 365
I'm having problems trying to calculate YTD values for monthly employee data. My data is structured similar to this and spans several years.

Each Employee has individual values for any given month/year. The list of employees change as folks come and go, making it difficult to use Offset (this is a pretty large workbook with several pivots, slicers, data cube and VBA - it's already slow enough):

I'm trying to come up with a formula that would allow me to calculate YTD for the MonthTotal values for each employee. I've attached a screenshot of similarly structured data - (I apologize, but my organization will not allow me to install the XL2BB application).

Note that every employee has a monthly entry, resulting in several rows of duplicated "Period" values for each month-year. This has tripped me up when trying to use some of the other YTD calculations I've found, but I'm guessing I need to combine with some sort of Match on the Employee name. I've been pulling my hair out for weeks and have posted on other forums, but have had no takers.

Any ideas how to go about calculating the YTD for each employee? Any and all help is greatly appreciated:


1680037650449.png
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Cannot manipulate data in a picture. Please reload using XL2BB. Help us to help you by making it easy to process and test your data.
 
Upvote 0
As mentioned, my organization will not allow me to install the XL2BB macros. Is there an alternate way to upload my sample spreadsheet?
 
Upvote 0
Hope this is what you want

Book4
ABCDEFGHIJK
1PeriodEmployeeDistrictlDistrict2MonthTotalEmployeeYTD Dist1YTD Dist2YTD Total
2Sep-22Jessica10210231125Jessica26861587318559
3Sep-22Mark6564586523Mark22563431336569
4Sep-22Heather65224083060Heather32093250935718
5Sep-22Jason6944751169Jason6944751169
6Oct-22Jessica5666841250Terri53212381770
7Oct-22Mark65425813235Terry84525603405
8Oct-22Heather98164257406
9Nov-22Jessica73512571992
10Nov-22Mark48345415024
11Nov-22Heather57571257700
12Dec-22Jessica58832123800
13Dec-22Mark20896149822
14Dec-22Terri175696871
15Dec-22Heather34525732918
16Jan-23Terri357542899
17Jan-23Jessica2442364260
18Jan-23Mark32554275752
19Jan-23Heather41781248541
20Feb-23Jessica67154616132
21Feb-23Terry84525603405
22Feb-23Mark52156926213
23Feb-23Heather23958546093
Sheet2


Power Query

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table3"]}[Content],
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Period", type date}, {"Employee", type text}, {"Districtl", Int64.Type}, {"District2", Int64.Type}, {"MonthTotal", Int64.Type}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"Employee"}, {{"YTD Dist1", each List.Sum([Districtl]), type nullable number}, {"YTD Dist2", each List.Sum([District2]), type nullable number}, {"YTD Total", each List.Sum([MonthTotal]), type nullable number}})
in
    #"Grouped Rows"
 
Upvote 0
Sort of. I hadn't considererd putting it into a separate table. Any way to get it into a YTD column that presents the running YTD total for MonthTotal?
 
Upvote 0
Not in my skill bank. Maybe someone else will come along shortly. Be patient.
 
Upvote 0
Thank you so much. I'm sure I can use your code in another section. I've been pulling my hair out over this.
 
Upvote 0
Actually found a way with a calculated field in a Pivot Table
Row LabelsSum of DistrictlSum of District2YTD
Heather
2022
Sep65224083060
Oct981642510466
Nov575712518166
Dec345257321084
2023
Jan41781248541
Feb239585414634
Jason
2022
Sep6944751169
Jessica
2022
Sep10210231125
Oct5666842375
Nov73512574367
Dec58832128167
2023
Jan2442364260
Feb671546110392
Mark
2022
Sep6564586523
Oct65425819758
Nov483454114782
Dec208961424604
2023
Jan32554275752
Feb521569211965
Terri
2022
Dec175696871
2023
Jan357542899
Terry
2023
Feb84525603405


Look at this link Add a Running Total in a Pivot Table
 
Upvote 0
The running total in the pivot assumes that there is only one entry for January, one for February, etc. whereas my data has several entries per month, for each employee. The YTD calculation needs to be by employee, down the column.

What you posted above came in like html table data - is that something I can use directly in Excel?
 
Upvote 0
If you build a pivot table, it will sum the monthly data by individual. As to second question, I don't understand what you are asking.
 
Upvote 0

Forum statistics

Threads
1,224,828
Messages
6,181,214
Members
453,024
Latest member
Wingit77

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top