Forum Discussion

mt_729's avatar
mt_729
Regular Visitor
2 years ago
Solved

Create a table based on two values with increments in Power Query

Hello,   I'm trying to create a dynamic table which will receive an input for minimum and maximum targets. The query should then add rows with 0.1 increments. What I find difficult is that a colum...
  • AlienSx's avatar
    2 years ago

    hello, mt_729 

    let
        Source = your_table,
        gen = List.Generate(
            () => [Target = Source{[Type = "Minimum"]}[Target], Payout = Source{[Type = "Minimum"]}[Payout]],
            (x) => x[Target] <= Source{[Type = "Maximum"]}[Target],
            (x) => [Target = x[Target] + .001, Payout = List.Min({Source{[Type = "Maximum"]}[Payout], x[Payout] + .015})]
        ),
        z = Table.FromRecords(gen)
    in
        z