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
HotChilli
3 years agoCommunity Champion
You refer to the column in the same way as the other parts of the code I provided e.g.
row[column name]
Obviously this has to be a number for the Date.AddMonths to work correctly.