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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
thomma
Frequent Visitor

Distribute value between start and end date, including ending sum

Hi all,

 

I have a date table and a contract table with contract including a contract amount and start- and end date. I'm trying to distribute the contract amount between a start and end date. I do this by calculating the amount to distribute per day (total/amount of days between start and end). Then I use something like the following DAX code to join the contract amount per day on a date table: Table = FILTER(CROSSJOIN(contracts,DimDates),contracts[StartDate]<='DimDates'[Date]&&contracts[EndDate]>='DimDates'[Date])

 

Problem is, I also want to model an ending sum of 3% of the total amount on 3 months after the ending date, ideally in the same crossjoin table. I don't know how to do this, anyone who can help me out?

 

Thanks in advance!

 

1 ACCEPTED SOLUTION
rajendraongole1
Super User
Super User

Hi @thomma -To get the contract amount over the duration of the contract and then add an additional 3%.

 

Create a calculated column with 3% of distribution daily amount

DailyAmount =
DIVIDE(
Contracts[ContractAmount],
DATEDIFF(Contracts[StartDate], Contracts[EndDate], DAY)
)

AdditionalAmount = Contracts[ContractAmount] * 0.03
AdditionalDate = EDATE(Contracts[EndDate], 3)

 

Create a new table that crossjoins the Contracts table with the Dimension Date table and includes the additional 3% amount:

ContractDistributions =
VAR CrossJoinTable =
FILTER(
CROSSJOIN(Contracts, DimDates),
(DimDates[Date] >= Contracts[StartDate] && DimDates[Date] <= Contracts[EndDate])
|| DimDates[Date] = Contracts[AdditionalDate]
)

VAR AddColumnsTable =
ADDCOLUMNS(
CrossJoinTable,
"DistributedAmount",
IF(
DimDates[Date] = Contracts[AdditionalDate],
Contracts[AdditionalAmount],
Contracts[DailyAmount]
)
)
RETURN
AddColumnsTable

 

add ContractDistributions table and use it in your report and see the distribution amount across contract period.

 

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!





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

Proud to be a Super User!





View solution in original post

1 REPLY 1
rajendraongole1
Super User
Super User

Hi @thomma -To get the contract amount over the duration of the contract and then add an additional 3%.

 

Create a calculated column with 3% of distribution daily amount

DailyAmount =
DIVIDE(
Contracts[ContractAmount],
DATEDIFF(Contracts[StartDate], Contracts[EndDate], DAY)
)

AdditionalAmount = Contracts[ContractAmount] * 0.03
AdditionalDate = EDATE(Contracts[EndDate], 3)

 

Create a new table that crossjoins the Contracts table with the Dimension Date table and includes the additional 3% amount:

ContractDistributions =
VAR CrossJoinTable =
FILTER(
CROSSJOIN(Contracts, DimDates),
(DimDates[Date] >= Contracts[StartDate] && DimDates[Date] <= Contracts[EndDate])
|| DimDates[Date] = Contracts[AdditionalDate]
)

VAR AddColumnsTable =
ADDCOLUMNS(
CrossJoinTable,
"DistributedAmount",
IF(
DimDates[Date] = Contracts[AdditionalDate],
Contracts[AdditionalAmount],
Contracts[DailyAmount]
)
)
RETURN
AddColumnsTable

 

add ContractDistributions table and use it in your report and see the distribution amount across contract period.

 

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!





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

Proud to be a Super User!





Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

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.