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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Yan2025
New Member

how to calcuated accumulated monthly qty with the purchase qty and validation periodes?

I have a contract table and a date table, which I have build the realtionship among the date table (Date) with contract table( Startdate and Enddate). How shall I build the measure to calculate the accumulated qty and costs each month from 01.01.2026 ?

 

ContractQTY(kg/per day)Price (€/kg)ProdukteStartdateEnddate
2025-1100037,142026/CA01.01.202631.12.2026
2025-2200042,3352026/Q101.01.202631.03.2026
2025-3200035,792026/Wi01.10.202631.03.2027
2025-4100030,842027/CA01.01.202731.12.2027
2025-5300030,242027/Wi01.10.202731.03.2028
2025-6100027,8152028/CA01.01.202831.12.2028
2025-71500027,872028/Q401.10.202831.12.2028
2025-8500069,052028/CA01.01.202831.12.2028
2025-9230031,3152027/CA01.01.202731.12.2027
2025-10230027,8222028/CA01.01.202831.12.2028
2025-11900036,082027/Q101.01.202731.03.2027
1 ACCEPTED SOLUTION
bhanu_gautam
Super User
Super User

@Yan2025  Ensure you have a date table that spans the entire period you are interested in, from 01.01.2026 onwards. 

Make sure your date table is related to the contract table using the Startdate and Enddate fields.

 

 This measure will calculate the total quantity up to the current date in the context of your report.

Accumulated Quantity =
CALCULATE(
SUM(Contract[QTY(kg/per day)]),
FILTER(
ALL(Date),
Date[Date] <= MAX(Date[Date]) &&
Date[Date] >= Contract[Startdate] &&
Date[Date] <= Contract[Enddate]
)
)

 

This measure will calculate the total cost up to the current date.

Accumulated Cost =
CALCULATE(
SUMX(
Contract,
Contract[QTY(kg/per day)] * Contract[Price (€/kg)]
),
FILTER(
ALL(Date),
Date[Date] <= MAX(Date[Date]) &&
Date[Date] >= Contract[Startdate] &&
Date[Date] <= Contract[Enddate]
)
)

 

You can now use these measures in a report to visualize the accumulated quantities and costs over time. Make sure your report's date range starts from 01.01.2026.

 




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






View solution in original post

4 REPLIES 4
v-karpurapud
Community Support
Community Support

Hi @Yan2025 

I hope this information is helpful. Please let me know if you have any further questions or if you'd like to discuss this further. If this answers your question, please Accept it as a solution and give it a 'Kudos' so others can find it easily.

Thank you.

v-karpurapud
Community Support
Community Support

Hi @Yan2025 

I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.

Thank you.

 



v-karpurapud
Community Support
Community Support

Hi @Yan2025 

Could you please confirm if your query have been resolved the solution provided by @bhanu_gautam ? If they have, kindly mark the helpful response and accept it as the solution. This will assist other community members in resolving similar issues more efficiently.

Thank you

bhanu_gautam
Super User
Super User

@Yan2025  Ensure you have a date table that spans the entire period you are interested in, from 01.01.2026 onwards. 

Make sure your date table is related to the contract table using the Startdate and Enddate fields.

 

 This measure will calculate the total quantity up to the current date in the context of your report.

Accumulated Quantity =
CALCULATE(
SUM(Contract[QTY(kg/per day)]),
FILTER(
ALL(Date),
Date[Date] <= MAX(Date[Date]) &&
Date[Date] >= Contract[Startdate] &&
Date[Date] <= Contract[Enddate]
)
)

 

This measure will calculate the total cost up to the current date.

Accumulated Cost =
CALCULATE(
SUMX(
Contract,
Contract[QTY(kg/per day)] * Contract[Price (€/kg)]
),
FILTER(
ALL(Date),
Date[Date] <= MAX(Date[Date]) &&
Date[Date] >= Contract[Startdate] &&
Date[Date] <= Contract[Enddate]
)
)

 

You can now use these measures in a report to visualize the accumulated quantities and costs over time. Make sure your report's date range starts from 01.01.2026.

 




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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