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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Kolumam
Post Prodigy
Post Prodigy

Yearly calculation based on start date and end date

I have a table with start date and end date for each contract and I would like to calculate the annual price for each contract on a prorated basis. Please find the sample table and expected output.

 

Sample Table:

Contract NameStart Date of ContractEnd Date of ContractPrice
X1/3/201731/3/2018387
X1/4/201831/3/2019425

 

Expected Output:

YearContract NamePro-rated Price
2017

X

290.25
2018X415.5
2019X293.75

 

@amitchandak @parry2k @mahoneypat @harshnathani @lbendlin @AntrikshSharma @AlB @AllisonKennedy @BA_Pete @Mariusz @az38 @Rocco_Emmaneel @ibarrau @Ashish_Mathur 

14 REPLIES 14
Ashish_Mathur
Super User
Super User

Hi,

I think your answers for 2018 and 2019 are incorrect.  You may download my PBI file from here.

Hope this helps.

Untitled.png


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

Thanks @Ashish_Mathur  It seems to be correct now but I have one another condition. 

 

If the start date starts inbetween a year for example April 2017, then the price is the same as the original price. That means if the price is 387 from April 2017 to May 2018, then the price for year 2017 is 387.

You are welcome.  Show a clear example and show your expected result (without any mistake please).


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

Hi @Ashish_Mathur 

 

Please find my table and expected output:

Kolumam_0-1594039458105.png

YearAnnual Contract Price
2017380
2018402.50
2019410

 

Here is the explanation:

2017 = 380 since the start date starts in the middle of the year. 

2018 = 380 * (end date - start date)/365 + 410 * (end date - start date)/365

similarly for other years.....

See in the above table, the first entry is 380 instead of 285 since the number of days in the calendar year in 2017 is < 365 for the first entry (start date of contract). Similarly for the calculation of the rest of the year, I want to use the difference in days, rather than a difference in months since the difference in days is more accurate.

Please let me know if you still need any clarification.

Hi,

I cannot understand this logic.  Why is the price of the first contract not being pro-rated for 9 months only?


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

Hi @Ashish_Mathur 

 

For the first year alone, it is not prorated as the contract is defined for a year. So the price for the first year will be the same as the price.

Hi @Ashish_Mathur any update?

Mariusz
Community Champion
Community Champion

BA_Pete
Super User
Super User

Hi @Kolumam ,

 

Can you provide the calculation for your [Pro-rated Price] column, or explain exactly what you want it to show please?

 

Thanks,

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Hi @BA_Pete 

 

Basically Prorated price is calculated as follows:

 

Prorated Price = Contract Price * (end date month - start date month)/12. See calculations below for each year.

 

2017 - 387 * 9/12

2018 - 387 * 3/12 + 425 * 9/12

2019 - 425 * 3/12

@Kolumam , check for measure 1 in the file. In 2019 we have only 3 months of data so showing only 3 months. There are few other overlaps too

https://www.dropbox.com/s/c2fgkaq17webog7/price%20split%20beteen%20start%20and%20end%20date.pbix?dl=...

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak I tried but see below the values are wrong.

Kolumam_0-1594031792121.png

380 * 9/12 = 285 should be the value for 2017 but as per your measure, it is giving 310. Please let me know.

@Kolumam , you have data from march 1-march, which means 10 months not 9

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak  No see screenshot below, my data starts from 1st April 2017. Please help.

Kolumam_0-1594033203923.png

 

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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