Forum Discussion
simon139
3 years agoFrequent Visitor
Creating a Power Query loop based on 3 columns
Hi Guys, I am not too good in Power Query / M language so really need your help here. I have a Python script which is working in PQ, but I need to rewrite it to 'M Language' as Power BI GateWay d...
- 3 years ago
You are pretty close.
I put this together for the Custom Column:
Table.AddColumn(#"Changed Type", "Custom", (row) => List.Generate( () => (row[start]), each _ <= row[duedate], each Date.AddMonths(_,6)))start and duedate are dates. I hardcoded the 6 just as an example
simon139
3 years agoFrequent Visitor
So I tried "List.Generate" function (without interval so far), but I get error after this (I changed dates to number as I tried almost everything)
= Table.AddColumn(#"Changed Type1", "Custom", each List.Generate(
()=> [x=Date.From([start_date])],
each [x]<=Date.From([duedate]),
each [x=Date.AddMonths([x],1)],
each [x]))