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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
dw700d
Post Patron
Post Patron

calculate running total for YOY and YOY at a specific point in time

I am creating a budget vs actuals dashboard  and I am focused on head count and expense. My data comes from 5 seperate tables including a date table. I would like help with creating four different measures. Thanks in advance for your assistance.

 

Measure 1 – I need to calculate  the variance between a running total of actual expenses vs a running total of budgeted expenses for the most recent year in my data set. Currently the most recent year in my data set is 2022.( In a few weeks however, I will have 2023 data and next year 2024 etc etc.). This calculation should be based on the most recent month of actuals. For example although my data set below has budgeted expenses until  12/1/2022 the measure would only include a running total  until 4/1/2022 because I only have 4 months of actuals in 2022. Based on the data below the variance would be 12,000 (70,000-58,000).

 

Measure 2 - – I need to calculate  the variance between a running total of the most recent years actual expenses vs a running total of the prior years actual  expense. Currently the most recent year in my data set is 2022.( In a few weeks however I will have 2023 data and next year 2024 etc etc.). This calculation should be based on the most recent month of actuals. the measure would only include a running total  until 4/1/2022 because I only have 4 months of actuals. Based on the data below the variance would be 14000 (44,000-58,000)

 

             Budget 
Datebudgeted expense
1/1/202110000
2/1/202111000
3/1/202112000
4/1/202112000
5/1/202113000
6/1/202114000
7/1/202112500
8/1/202120000
9/1/202121000
10/1/202110000
11/1/202111000
12/1/202112000
1/1/202213000
2/1/202218000
3/1/202219000
4/1/202220000
5/1/202210000
6/1/202211000
7/1/202212000
8/1/202210000
9/1/202210000
10/1/202210000
11/1/202210000
12/1/202211000

 

           Actuals
DateActual expense
1/1/20219000
2/1/202110000
3/1/202112000
4/1/202113000
5/1/202115000
6/1/202111000
7/1/202110000
8/1/202120000
9/1/202121000
10/1/202119000
11/1/202112000
12/1/202111000
1/1/202210000
2/1/202215000
3/1/202215000
4/1/202218000
5/1/2022 
6/1/2022 
7/1/2022 
8/1/2022 
9/1/2022 
10/1/2022 
11/1/2022 
12/1/2022 

 

Measure 3 – I need to calculate  the variance between the most recent month's headcount vs the most recent month's budgeted headcount for the most recent year in my data set. Currently the most recent year in my data set is 2022.( In a few weeks however I will have 2023 data and next year 2024 etc etc.). This calculation should be based on the most recent month's headcount. For example, although my data set below has budgeted headcount until  12/1/2022 the measure would only calculate headcount on  4/1/2022 because I only have 4 months of actuals. Based on the data below the variance would be 22 (425-403) (***This calculation does not use running total)

 

Measure 4 - – I need to calculate  the variance between the most recent year head count vs the prior year’s headcount . Currently the most recent year in my data set is 2022.( In a few weeks however I will have 2023 data and next year 2024 etc etc.). This calculation should be based on the most recent month’s headcount. the measure would only include  the month of 4/1/2022 because I am in the 4th months of actuals. Based on the data below the variance would be 33 (403-370) (***This calculation does not use running total)

 

Head count          Budget
dateHead count
1/1/2022100
2/1/2022105
3/1/2022110
4/1/2022110
5/1/2022100
6/1/2022129
7/1/2022100
8/1/2022130
9/1/2022100
10/1/2022100
11/1/2022120
12/1/2022110

 

 

Head count Actuals
dateHead count
1/1/202195
2/1/202198
3/1/2021100
4/1/2021110
5/1/2021100
6/1/2021200
7/1/2021100
8/1/2021120
9/1/2021130
10/1/2021150
11/1/2021110
12/1/2021110
1/1/2022100
2/1/2022100
3/1/202290
4/1/202280
5/1/202275
6/1/202240
7/1/2022100
8/1/2022120
9/1/2022110
10/1/2022190
11/1/2022180
12/1/2022110
1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

You may download my PBI file from here.  I have solved the first 2 questions.  Apply the same principle to solve the other 2.

Hope this helps.

Untitled.png


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

View solution in original post

2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

You may download my PBI file from here.  I have solved the first 2 questions.  Apply the same principle to solve the other 2.

Hope this helps.

Untitled.png


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

@dw700d , Create measure like with help from date Table

 

Cumm Sales =

Var _max = maxx(allselected(Sales), Sales[sales Date])

return

CALCULATE(SUM(Sales[Sales Amount]),filter(all('Date'),'Date'[date] <=max('Date'[date]) && Date[Date] <= _max) )

 

or

 

Cumm Sales =

Var _max = maxx(allselected(Sales), Sales[sales Date])

return

if(max(Date[Date]) <=_max ,

CALCULATE(SUM(Sales[Sales Amount]),filter(all('Date'),'Date'[date] <=max('Date'[date])) ) , Blank())

 

 

Running Total/ Cumulative: https://www.youtube.com/watch?v=h2wsO332LUo&list=PLPaNVDMhUXGaaqV92SBD5X2hk3TMNlHhb&index=41

 

Power BI Window function Rolling, Cumulative/Running Total, WTD, MTD, QTD, YTD, FYTD: https://youtu.be/nxc_IWl-tTc

 

 

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

Announcements
ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.