Forum Discussion
List.Alternate ,
- 1 year ago
Hi Dicken,
Thank you for reaching out to the Microsoft fabric community forum.
you can't reliably use List.Alternate to get {5, 12, 19, 26} starting at 0 or 1 because it picks by position, not value. Changing the starting point shifts the positions of your desired values.
If you want to generate {5, 12, 19, 26}, the easier way is:
List.Generate(() => 5, each _ <= 26, each _ + 7)
Starts at 5
Adds 7 each time
Stops when the value is > 26
This directly gives you:
{5, 12, 19, 26}
List.Alternate picks items based on their position in the list, not the actual values.Please find the attached screenshot for your reference.
If the response has addressed your query, please Accept it as a solution and give a 'Kudos' so other members can easily find it
Best Regards,
Harshitha.
Community Support Team - 1 year ago
Not sure what you mean by "same result" in this context. If you mean the same pattern (incrementing by seven (7) but with the sequence starting at 0 or 1), just start maxlist at that number.
eg:
[ rc = 23 , grupe = 5, insertN = 2, mx = (Number.IntegerDivide( rc, grupe) * insertN) + rc , maxlist = {0..mx} , altlist = List.Alternate(maxlist,(grupe + insertN )-1 ,1,1) ]-->
If you mean something else, please be more specific
Not sure what you mean by "same result" in this context. If you mean the same pattern (incrementing by seven (7) but with the sequence starting at 0 or 1), just start maxlist at that number.
eg:
[
rc = 23 ,
grupe = 5,
insertN = 2,
mx = (Number.IntegerDivide( rc, grupe) * insertN) + rc ,
maxlist = {0..mx} ,
altlist = List.Alternate(maxlist,(grupe + insertN )-1 ,1,1)
]
-->
If you mean something else, please be more specific