cancel
Showing results 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

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):

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
Community Support

Hi @Berl21 ,

Based on my testing, please try the following methods:

1.Create the sample table.

2.Create the new custom column in power query.

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)``

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

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.

2 REPLIES 2
Community Support

Hi @Berl21 ,

Based on my testing, please try the following methods:

1.Create the sample table.

2.Create the new custom column in power query.

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)``

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

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.

Super User

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

Proud to be a Super User!

Announcements

#### 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.

#### Power BI Monthly Update - August 2024

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

#### Fabric Community Update - August 2024

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

Top Solution Authors
Top Kudoed Authors