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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Anonymous
Not applicable

How to spread value between two dates ?

Hi everyone,

 

I need some help on my Power BI.

 

I am trying to spread the value of a project over several months, to know exactly how much I will have to produce every month.

For exemple, if I have a project sold at 60,000$ over 3 months, I will have to produce 20,000$ per month.

This is the data I have :

 

Project Order DateDeliveryAmount
1656KL5-Jan-20204-May-2020$100,000.00
1568MP8-Feb-20203-Apr-2020$85,000.00
1518KI18-Feb-202030-Apr-2020$120,000.00
5168GT21-Mar-202021-Jun-2020$50,000.00

 

This is the output i'm looking for :

 

Project NumberJanuaryFebruaryMarchAprilMayJuneTotal
1656KL$21,666.67$24,166.67$25,833.33$25,000.00$3,333.33 $100,000.00
1568MP $32,454.55$47,909.09$4,636.36  $85,000.00
1518KI $18,333.33$51,666.67$50,000.00  $120,000.00
5168GT  $5,434.78$16,304.35$16,847.83$11,413.04$50,000.00

 

Of course every project doesn't start at the same date, not even on the first day of the month. So the amount allocated to each month has to take in consideration the number of day in each month.

 

I hope i'm clear enough, don't hesitate to ask me more questions about this.

 

Thank you very much for your help.

 

Nicholas

 

13 REPLIES 13
Ashish_Mathur
Super User
Super User

Hi,

I think your calculation of amount per day is incorrect.  For the first project, it should be 100000/121 = 826.4463 and not 100000/120=833.3333.  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/

Ashish:

 

The image you posted, shown below, had the correct "Total values".

EdwardWer_0-1716997502775.png

 

The values in the file uploaded by someone else (URL below) had incorrect Total values, please see the screen shot below.

 

EdwardWer_1-1716997708765.png

 

 

https://community.fabric.microsoft.com/oxcrx34285/attachments/oxcrx34285/power-bi-designer/439517/1/...

 

I was curious how you corrected this.

 

Thanks,

Edward

Hi,

I cannot understand your question.  Offer a simple explanation and show the expected result.


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

Ashish:

 

Hello. I could not download the file with the link you provided.

Can you please advise what change you made to the DAX Measure "MonthAmount"?

 

Thanks,

Edward

Hi,

I do not have that file anymore.  Describe the question and show the expected result.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-lid-msft
Community Support
Community Support

Hi @Anonymous ,

 

We can create a calculated table and a measure to meet your requriement:

 

Calculated Table:

 

 

DateTable = CALENDAR(MIN('Table'[Order Date]),MAX('Table'[Delivery]))

 

 

Measure:

 

 

MonthAmount = SUMX(DISTINCT('Table'[Project]),
CALCULATE(SUM ( 'Table'[Amount] ))
    / DATEDIFF ( MIN ( 'Table'[Order Date] ), MAX ( 'Table'[Delivery] ), DAY )
    * COUNTROWS(INTERSECT('DateTable',CALENDAR(MIN('Table'[Order Date])+1,MAX('Table'[Delivery])))))
    

 

 

2.jpg

 


Best regards,

 

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

Hi!

 

Thank you so much for your post - it was of a great help!
Just one more thing, is there a way to make the spread throughout the months flat? Instead of calculating the volume per month by multipling the days, we have the entire year volume just divided by 12 and than, only showing this "flat volume" at the intersection of the months between "Order date" and "Delivery Date"?

Once again, thank you so much for your kind help!

This solution is really useful for my use case too. I don't suppose you would mind taking the time to explain how it works? Or link to the material where you got this from yourself?

Anonymous
Not applicable

Hi @v-lid-msft 

 

Thanks a lot for this solution, I managed to apply it on my Power BI.

Just two questions :

- What is your first picture about ? what are TAB_Litig_File and TAB_Prov ?

- Would it be possible to have a column with every amount for every month for each project ? I need this information to create another Matrix Table, in order to compare with my maximum production capacity.

 

Thanks again for your help.

 

Nicho

Hi @Anonymous ,

 

 

How about the result after you follow the suggestions mentioned in my original post?Could you please provide more details about it If it doesn't meet your requirement?


Best regards,

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

Hi @Anonymous ,

 

Sorry for that we put an unnessary screenshot, we selected wrong file when upload, it does not help in this post.

 

What is the column with every amount, Could you please share a mockup table based on the tables you have shared?


Best regards,

 

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Adamtall
Resolver III
Resolver III

Hi,

 

This is kinda complexed. You need to create more rows in powerQuery.

Create a blank Query and copy this code.

 

Spoiler
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("VY49C8IwEIb/SgkdE7mLJmQtFMXWYge30CHaDIq2Elqh/94DaSTbvR8P91rL2jA+/G3KGGfn0PuQlW7yJEr/vH98WOgsXuM8TKzjlqFWuj6Rp0TlBiFBAomdaNyyihwBOABsAH6I0qZpKTBi769rayuKd4iIUSmBpj6SjykCCYMyeaNQm8OFAom0JtZIVXMcmqs/030B", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [#"(blank)" = _t, #"(blank).1" = _t, #"(blank).2" = _t, #"(blank).3" = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"(blank)", type text}, {"(blank).1", type text}, {"(blank).2", type text}, {"(blank).3", type text}}),
#"Promoted Headers" = Table.PromoteHeaders(#"Changed Type", [PromoteAllScalars=true]),
#"Changed Type1" = Table.TransformColumnTypes(#"Promoted Headers",{{"Project ", type text}, {"Order Date", type date}, {"Delivery", type date}, {"Amount", type text}}),
#"Replaced Value" = Table.ReplaceValue(#"Changed Type1","$","",Replacer.ReplaceText,{"Amount"}),
#"Replaced Value1" = Table.ReplaceValue(#"Replaced Value",",","",Replacer.ReplaceText,{"Amount"}),
#"Replaced Value2" = Table.ReplaceValue(#"Replaced Value1",".",",",Replacer.ReplaceText,{"Amount"}),
#"Changed Type2" = Table.TransformColumnTypes(#"Replaced Value2",{{"Amount", type number}}),
#"Inserted Date Subtraction" = Table.AddColumn(#"Changed Type2", "Subtraction", each Duration.Days([Delivery] - [Order Date])),
#"Added Custom" = Table.AddColumn(#"Inserted Date Subtraction", "Custom", each { Number.From([Order Date]) +1 ..Number.From([Delivery] ) }),
#"Expanded Custom" = Table.ExpandListColumn(#"Added Custom", "Custom"),
#"Changed Type3" = Table.TransformColumnTypes(#"Expanded Custom",{{"Custom", type date}}),
#"Inserted Division" = Table.AddColumn(#"Changed Type3", "Division", each [Amount] / [Subtraction], type number)
in
#"Inserted Division"

When you understand It you can applie it to your orginal code.

 

test30.PNG

 

Hope this can help you.

 

/Adam

 

Anonymous
Not applicable

Hi @Adamtall , Thank you very much for your answer.

I'm not sure to understand entirely your code, but i'm gonna try to apply it to my case and test it.

I can see on your screenshot it worked so it should on mine too !

 

I'll let you know, thanks again for your time.

 

Nicho

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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