Forum Discussion

GerryL's avatar
GerryL
Frequent Visitor
4 years ago

List.Numbers Within a Range

Hello,

 

I'm trying to generate a list of numbers in my dataset within a range from 10-50 in an increment of 10. In other words, as it generates the number for each row, when it gets to 50, it should go back to 10. I can't figure out a way to do this with List.Numbers. 

 

 

8 Replies

  • Vijay_A_Verma's avatar
    Vijay_A_Verma
    Most Valuable Professional

    Let's say you want to generate 18 numbers...Use below formula (replace 18 with the required number as per your need)

    = List.Generate(()=>[x=10,i=1], each [i]<=18, each [i=[i]+1, x=if [x]=50 then 10 else [x]+10], each [x])
    • GerryL's avatar
      GerryL
      Frequent Visitor

      Thanks. This isn't working. It says a Token Comma is expected.

       

       

      • Vijay_A_Verma's avatar
        Vijay_A_Verma
        Most Valuable Professional

        You can't replace () with anything else. Everything else is correct. It has to be

        =List.Generate(()=>[x=10...........