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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Berl21
Helper III
Helper III

Compute customer life time value by payment period

Hi,

I have built a model to calculate Life Time Value based on the months in which contracts are valid, but need to change the logic to compute the LTV by payment period or daily LTV.

This what I need to get as a result (this or the same set up on a daily basis, just not restricted to the calendar month structure):

Berl21_0-1723566471995.png

I was thinking I could generate a list to get the list of days covered by the contract (instead of the list of months) in Power Query, then make a join on the date column with my date table.  But I don't find a function similar to  Date.StartOfMonth that would replace the month list generation: 

List.Select(
List.Dates(
Date.StartOfMonth([Vertragsbeginn]),
Number.From([Vertragsende]- [Vertragsbeginn]),
#duration(1, 0, 0, 0)),
each Date.Day(_) = 1)

Basically I just need to generate the list of days based on the contract start date and taking into account the number of months in which the contract is valid. 

I can't get my head around as how to get there in Power Query. How can I rewrite this or approach this in a different way?

Any help will be greatly appreciated 🙂 🙂 

1 ACCEPTED SOLUTION
v-jiewu-msft
Community Support
Community Support

Hi @Berl21 ,

Based on my testing, please try the following methods:

1.Create the sample table.

vjiewumsft_0-1723622883818.png

2.Create the new custom column in power query.

vjiewumsft_1-1723622895914.png

3.Drag Enter the following formula.

List.Select(List.Dates([Start Date],Duration.TotalDays([Payment period] - [Start Date]), #duration(1,0,0,0)), each true)

vjiewumsft_2-1723622910100.png

4.Expand the list. The result is shown below.

vjiewumsft_3-1723622932279.png

vjiewumsft_4-1723622938663.png

 

Best Regards,

Wisdom Wu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-jiewu-msft
Community Support
Community Support

Hi @Berl21 ,

Based on my testing, please try the following methods:

1.Create the sample table.

vjiewumsft_0-1723622883818.png

2.Create the new custom column in power query.

vjiewumsft_1-1723622895914.png

3.Drag Enter the following formula.

List.Select(List.Dates([Start Date],Duration.TotalDays([Payment period] - [Start Date]), #duration(1,0,0,0)), each true)

vjiewumsft_2-1723622910100.png

4.Expand the list. The result is shown below.

vjiewumsft_3-1723622932279.png

vjiewumsft_4-1723622938663.png

 

Best Regards,

Wisdom Wu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

ryan_mayu
Super User
Super User

why the end date of first row is 26th, and for the second row is 28th?





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

Proud to be a Super User!




Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

AugPowerBI_Carousel

Power BI Monthly Update - August 2024

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

August Carousel

Fabric Community Update - August 2024

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