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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Kolumam
Post Prodigy
Post Prodigy

Calculating Annual Contract based on Start Date and End Date

I have a table that has a start date of the contract starting from March 2017 and ending at April 2018. I want to calculate the yearly contract price. See the table below.

Contract NameStart Date of ContractEnd Date of ContractPrice
X1/3/201731/3/2018387
X1/4/201831/3/2019387
X1/4/201931/12/2020250

 

I want to calculate what was the annual price for each year and for all the contracts. How do I do this?

@amitchandak @parry2k @mahoneypat @harshnathani 

6 REPLIES 6
harshnathani
Community Champion
Community Champion

HI @Kolumam ,

 

Let me know if you are lookin for this. If not, pls provide the expected o/p.

 

You can try this measure.

 

Annual Contract Price =
VAR diff_stdat_endate =
    DATEDIFF (
        MAX ( 'Table'[Start Date of Contract] ),
        MAX ( 'Table'[End Date of Contract] ),
        MONTH
    )
RETURN
    DIVIDE (
        12,
        diff_stdat_endate
    )
        * MAX ( 'Table'[Price] )

 

 

1.jpg

 


Regards,

Harsh Nathani


Appreciate with a Kudos!! (Click the Thumbs Up Button)

Did I answer your question? Mark my post as a solution!

 

 

Hi @harshnathani 

 

Thanks but I need to plot the values using a Year column. How do I do this for each contract?

 

@Kolumam , can share expected output.

Current Contract  = CALCULATE(Maxx(FILTER(Contract,Employee[Start Date]<=max('Date'[Date]) && (ISBLANK(Contract[End Date]) || Contract[End Date]>max('Date'[Date]))),(Contract[Price])),CROSSFILTER(Contract[Start Date],'Date'[Date],None))

 

If you create a date table and join it with the start date above will give max price for the year. Year should be there in Date table

Hi @amitchandak @harshnathani 

 

As per the formula given by @harshnathani , I tried it but the issue is the date. When I filter the year to 2020, it should ideally show the "Annual Contract Price" as (450*7/12) which is 262.5. How do I add a proper date axis and filter it with year?

Kolumam_0-1594022765734.png

 

amitchandak
Super User
Super User

Hi @amitchandak 

 

The solution looks very complex.

I am looking for a yearly contract price calculation for each contract.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.