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
Thank you HotChilli. I got to the point where I can add hardcoded month, but I just do not know how to put that month into variable which is based on value in other column
simon139
3 years agoFrequent Visitor
Ok I changed the formula and it actually works - thank you so much!!
I would appreciate If you would quickly explain what does the (row) => stands for? And why it works with (row) bud it didn't work without it.
= Table.AddColumn(#"Renamed Columns", "Custom", (row) =>
List.Generate( () => (row[start_date]),
each _ <= row[duedate],
each Date.AddMonths(_,row[billing])))