Forum Discussion
How to generate a new table by duplicating items from another table based on recurrence
- 3 years ago
Hi EvaPBI,
This is the function which generates a list of dates between the start and end date with a given step:
f = (Start, End, Step)=> List.Generate(()=>Start, each _ < End, each Date.AddDays (_, Step) )You can use it as this:
f(#date(2023, 1, 1), #date(2024, 11, 30), 14)Cheers,
John
Hi John!
Thank you for your help! I was able to replicate your solution and it works fine!
About the last category, I tried to add the weekly logic in the query, but it still doesn't work.
I previously made a mistake about this type of frequency. There are actually two types: weekly or every two weeks (2weeks).
For weekly, I would like to generate 52 rows (from the Start Date + 7 days for each week)
For 2weeks, I would like to generate 26 rows (from the Start Date + 14 days)
I saw a similar solution on the forum, but I couldn't adjust my query.
Thank you very much,
-Eva
Hi EvaPBI,
This is the function which generates a list of dates between the start and end date with a given step:
f = (Start, End, Step)=> List.Generate(()=>Start, each _ < End, each Date.AddDays (_, Step) )
You can use it as this:
f(#date(2023, 1, 1), #date(2024, 11, 30), 14)
Cheers,
John