Forum Discussion

ctrip77's avatar
ctrip77
Frequent Visitor
7 years ago
Solved

Syntax Error in List.Generate Function

Hi everyone!

Im trying to do a date list (in power Query), starting on a given date and then get the next 4 years.

I did this:

List.Generate(()=> [ x = 1 , y = {}] , each [x] <= 4 , each [x = [x]+1] , each Date.AddYears([Date_start] ,1) )

But Im receiving error, I dont know where is my syntax error, if anybody see it or if there is another solution I would appreciate.

thanks in advance!

  • ok, found it:

     

    List.Generate( () => [ a = [Date_start], b = Date.AddYears([Date_start] ,4) ], each [a] <= [b], each [ a = Date.AddYears( [a], 1 ), b = [b] ], each [a] )

3 Replies