Forum Discussion

theo's avatar
theo
Icon for Helper III rankHelper III
7 years ago
Solved

how to use list.generate to pass as a loop

Hi.  This might be simple but still a newbie here.  Would appreciate any help to push me in the right direction. What I am trying to do is count the rows the equal to current tix-1 current tix-2 ...
  • theo's avatar
    theo
    7 years ago

    Through research, I found the solution:

     

    = 
    
          Table.AddColumn(
    
            #"Added Custom2", 
    
            "Count", each List.Sum(
    
                                        List.Generate(
    
                            () => [Count=List.Count(
    
                                            Table.SelectRows(
    
                                                #"Added Custom2", 
    
                                                (C) => C[Tix] = [Tix]-Continue)
    
                                                            [Column1]),
    
                                                            Continue =1],
    
                            each [Continue]<=10,
    
                            each [Final_Item = [Final_Item], 
    
                                  Continue =[Continue]+1],
    
                            each [Count])))