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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Cost Allocation over time.

Dearest Fellow PBI users,
I have a dataset of 23k leases. Each lease has its own start date, end date, category, and monthly amount. The start dates begin 1/1/2018 and end dates up to 12/31/30. I need to show cost by year, quarter, month, and category. I've created a date table. I cant get past this. I've followed a few examples including one from ExcelFont that massively expanded my data and inflated the numbers. Sample data included.
 When I do the calculations manually, I'm not able to group by date values as they are column headers. Please help me figure this one out. 

Lease #Start DateEnd DateMonthly AmountCategory
18/1/20198/1/2024$5.99PC
17/1/20197/1/2024$6Server
13/1/20203/1/2025$5.93Phone
12/1/20202/1/2025$5.96Scanner 
12/1/20182/1/2023$5.94Printer
611/1/201811/1/2023$5.88Data Ctr
77/1/20187/1/2023$5.95PC
83/1/20183/1/2023$19.33Server
99/1/20189/1/2023$19.32Phone
1012/1/201812/1/2023$12.43Scanner 
108/1/20188/1/2023$25.15Printer
105/1/20185/1/2023$12.42Data Ctr
106/1/20186/1/2023$24.41PC
104/1/20184/1/2023$20.37Server
155/1/20191/1/2025$25.14Phone
161/1/20209/1/2025$48.89Scanner 
179/1/202012/1/2024$49.46Printer
1812/1/20198/1/2026$18.10Data Ctr
198/1/202111/1/2024$25.13PC
2011/1/201910/1/2025$28.30Server
2110/1/20204/1/2025$4.11Phone
214/1/202010/1/2024$8.94Scanner 
2110/1/201912/1/2025$28.18Printer
2112/1/20202/1/2026$24.29Data Ctr
252/1/202112/1/2027$5.35PC
2612/1/202212/1/2026$56.29Server
279/1/20199/1/2024$13.12Phone
287/1/20207/1/2025$11.36Scanner 
295/1/20205/1/2025$27.57Printer
302/1/20232/1/2027$27.24Data Ctr
313/1/20232/1/2028$6.15PC
328/1/20203/1/2027$6.13Server
339/1/20228/1/2025$14.82Phone
345/1/20219/1/2027$8.05Scanner 
352/1/20225/1/2026$6.07Printer
366/1/20226/1/2027$18.63Data Ctr
3711/1/202111/1/2026$8.24PC
383/1/20193/1/2024$8.32Server
393/1/20215/1/2024$8.09Phone
4011/1/20203/1/2026$5.98Scanner 
416/1/201911/1/2025$49.40Printer
422/10/20196/1/2024$92.66Data Ctr
432/11/20193/1/2028$130.18PC
442/12/20198/1/2024$51.86Server
452/13/20197/1/2024$54.81Phone
462/14/20193/1/2025$16.85Scanner 
472/15/20192/1/2025$24.48Printer
482/16/20192/1/2023$61.82Data Ctr
492/17/201911/1/2023$571.92PC
492/18/20197/1/2023$20.02Server
492/19/20193/1/2023$109.62Phone
492/20/20199/1/2023$119Scanner 
492/21/201912/1/2023$1,292.80Printer
542/22/20198/1/2023$48.96Data Ctr
552/23/20195/1/2023$55.08PC
562/24/20196/1/2023$27.45Server
572/25/20194/1/2023$32.83Phone
582/26/20191/1/2025$88.90Scanner 
592/27/20199/1/2025$23,215.72Printer
602/28/201912/1/2024$107.98Data Ctr
603/1/20198/1/2026$48.34PC
603/2/201911/1/2024$20.31Server
603/3/201910/1/2025$171.26Phone
643/4/20198/1/2024$3,009.88Scanner 
653/5/20197/1/2024$58.36Printer
663/6/20193/1/2025$48.79Data Ctr
673/7/20192/1/2025$729.58PC
683/8/20192/1/2023$272.80Server
693/9/201911/1/2023$30.91Phone
4 REPLIES 4
Anonymous
Not applicable

Hi @Anonymous ,

 

Please check the pbix file:

vcgaomsft_0-1690446127734.png

If I have misunderstood your needs, please feel free to contact us.

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

Anonymous
Not applicable

After additonal evaluation, there is still an issue. If the in service date in in Q4, its putting the total amount in Q4 each year opposed to allocating it monthly. 
If a term is 60m, it should show cost for 60 consecutive months beginning at the start date and ending at the end date. 

rylander_0-1690471615430.png

 

Anonymous
Not applicable

I was able to replicate everything with one exception. I'm getting an error "end of expression was reached" I'm not able to see my error. Please take a look.

CostAllocation =
VAR _CurrentYear = MAX('Calendar'[Year])
VAR _CurrentQuarter = MAX('Calendar'[QuarterNum])
VAR _CurrentMonth = MAX('Calendar'[Month])
RETURN
CALCULATE(
[TotalLeaseCost],
FILTER(
'Lease',
YEAR('Lease'[IN_SERVICE_DATE]) <= _CurrentYear && YEAR('Lease'[FINAL_EOT_DATE]) >= _CurrentYear &&
QUARTER('Lease'[IN_SERVICE_DATE]) <= _CurrentQuarter && QUARTER('Lease'[FINAL_EOT_DATE]) >= _CurrentQuarter &&
MONTH('Lease'[IN_SERVICE_DATE]) <= _CurrentMonth && MONTH('Lease'[FINAL_EOT_DATE]]) >= _CurrentMonth
)
)

Anonymous
Not applicable

there was a double "]" on the final line, issue resolved!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors