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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
Kolumam
Post Prodigy
Post Prodigy

Need help on calculating annual contract (DAX) [Stuck for Days]

Hi All,

 

I have the below table.

 

Start Date of ContractEnd Date of ContractOperation NameComprehensive O&M Price
1/7/201931/8/2019X375
1/9/201931/3/2020X405
12/5/202031/12/2021X385
1/4/201731/3/2018Y380
1/4/201831/3/2020Y410
11/5/202031/12/2021Y303

 

Based on the start date of contract and end date of contract for each Operation Name, I need to calculate the annual contract for each operation name.

 

Expected Output with Calculation: 

 

Operation NameYearAnnual ContractCalculation
X2019395(375*60/180)+(405*120/180)
X2020353.01(405*90/365)+(385*240/365)
X2021385(385*365/365)
Y2017380(380*365/365)
Y2018396.97(380*90/365)+(410*270/365)
Y2019410(410*365/365)
Y2020300.23(410*90/365)*(303*240/365)
Y2021303303*365/365

 

Please find my explanation for the calculation.

(375*60/180)+(405*120/180)

Here 60 is the number of days for which the contract is valid (end date - start date) and 180 is the total number of days between 1 July 2019 and 31st December 2019. I am using the days approximately but ideally it should be the exact number of days.

For this one: (405*90/365)+(385*240/365)

90 because the contract is from 1st Jan 2020 to 31 March 2020 and 240 is because the the start date is 12/5/2020 and ends at 31st Dec 2020. I am taking rough numbers. Not the exact difference in days.

For the last contract, the contract applies for whole year. Hence 385*365/365

Thanks in advance for the help.

 

 @parry2k @mahoney19  @parry2k @az38 @jdbuchanan71 @mahoneypat @edhans @harshnathani @v-kellya-msft @MFelix @Ashish_Mathur @BA_Pete @ryan_mayu @kbuckvol @Alexander76877 @Petazo @Mariusz @TomMartens @Greg_Deckler @tjd @Sean @mikstra @AllisonKennedy @EricHulshof @briandpeterson @USG_Phil @vpatel55 @mwegener @v-piga-msft @tex628 @sturlaws @Vvelarde @CheenuSing @MarcelBeug @Zubair_Muhammad @v-piga-msft @danextian @MattAL @MattAllington @roalexan @Alexander76877 @kgc 

2 REPLIES 2
v-lili6-msft
Community Support
Community Support

hi  @Kolumam 

You could refer to this same blog:

https://community.powerbi.com/t5/Quick-Measures-Gallery/Periodic-Billing/m-p/409365

 

The only difference is why denominator is 180 or 360 in your case.

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
lbendlin
Super User
Super User

That is a true nightmare. I would go down to the day level and for each operation and day calculate the day's contract value.

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.