The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
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 🙂 🙂
Solved! Go to Solution.
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.
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.
why the end date of first row is 26th, and for the second row is 28th?
Proud to be a Super User!
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
User | Count |
---|---|
118 | |
87 | |
75 | |
53 | |
45 |
User | Count |
---|---|
135 | |
121 | |
77 | |
65 | |
64 |