Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
informer
Helper I
Helper I

function - List.Alternate -what's meaning of ZERO (0) for the forth parameter

List.Alternate({"A".." Z"},1,1,1) c= 1 => First selected item is  (A) => skips value B because b = 1 and keeps next item = value (C) => skips next value (D)  and keeps next item E ....
listalternate111.JPG

List.Alternate({"A".."Z"},1,1) = List.Alternate({"A".."Z"},1,1,0), what's meaning of ZERO (0) for the forth parameter ?
listalternate11.-110JPG.JPG
1 ACCEPTED SOLUTION

@informer 
The offset 0 means the function starts processing from the first element, no off set happens hear, it repects the 1st parameter and goes on with the cycle defined in the 3rd parameter.

Check this example:

2nd Parameter = 2, it skips from the begining as the 4th Paramter is 0

Fowmy_0-1739096739117.png


2nd Parameter = 2, it skips 2 but starting from 1 as I have entered 1 as the offset paramter in the 4th parameter. I am telling to start the process after 1 (1st element)

 

Fowmy_1-1739096854729.png


Hope I managed to explain 🙂





Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

9 REPLIES 9
v-csrikanth
Community Support
Community Support

Hi @informer  
As per the requirement, I have reproduced it locally on my machine and uploaded the attached .pbix file. Please try it out and let me know your understanding of the List.Alternate functionality.

Here is a detailed explanation of the List.Alternate parameters.

Function Explanation Result
List.Alternate(OriginalList, 1, 1, 1) Starts at index 1(1st element = 1), keeps 1, skips 1, and continues. {1, 3, 5, 7, 9}
List.Alternate(OriginalList, 1, 1, 0) Starts at index 0(1st element = 2), keeps 1, skips 1, and continues. {2, 4, 6, 8, 10}
List.Alternate(OriginalList, 1, 1) Defaults to Offset = 0(same as List.Alternate(OriginalList, 1, 1, 0)). {2, 4, 6, 8, 10}

 

If the above information helps you, please give us a Kudos and marked the reply Accept as a Solution.

Thanks,
Cheri Srikanth

 

Hi @informer 
It's been a while since I heard back from you and I wanted to follow up. Have you had a chance to try the solutions that have been offered. If the issue has been resolved, can you mark the post as Accept as Solution.

Thanks and Regrds, 

Cheri Srikanth 

informer
Helper I
Helper I

List.Alternate( { 1..10 }, 1, 1, 1 ) = { 1, 3, 5, 7, 9 } => Select the FIRST item of the list: Ok
List.Alternate( { 1..10 }, 1, 1, 0 ) = Equals { 2, 4, 6, 8, 10 } => So what is the ZERO ITEM ?
dufoq3
Super User
Super User

Hi @informer, check Rick's article.


Note: Check this link to learn how to use my query.
Check this link if you don't know how to provide sample data.

ZhangKun
Super User
Super User

"offset" means to select "offset" values ​​at the beginning. In the figure below, blue and green represents the final result. 

ZhangKun_0-1739034306407.png

 

Fowmy
Super User
Super User

@informer 

The 4th Parameter: Specifies the offset after which the function begins skipping values.

Refer these example:

// Skips 1 value (arg 1) then returns 1 values (arg 2),  start skipping from offset 0(arg 3)
List.Alternate( { 1..10 }, 1, 1, 0 ) // Equals { 2, 4, 6, 8, 10 }

// Skips 1 value (arg 1) then returns 1 values (arg 2), start skipping from offset 1(arg 3)
List.Alternate( { 1..10 }, 1, 1, 1 ) // Equals { 1, 3, 5, 7, 9 }

// Skips 1 value (arg 1) then returns 1 values (arg 2), start skipping from offset 4(arg 3)
List.Alternate( { 1..10 }, 1, 1, 4 ) // Equals { 1, 2, 3, 4, 6, 8, 10 }




Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Hi, Thanks for your responses

List.Alternate( { 1..10 }, 1, 1, 1 ) = Equals { 1, 3, 5, 7, 9 }

means that the first item of the list is selected = 1

List.Alternate( { 1..10 }, 1, 1, 0 ) = { 2, 4, 6, 8, 10 }



So what is the Zero item ?

@informer 
The offset 0 means the function starts processing from the first element, no off set happens hear, it repects the 1st parameter and goes on with the cycle defined in the 3rd parameter.

Check this example:

2nd Parameter = 2, it skips from the begining as the 4th Paramter is 0

Fowmy_0-1739096739117.png


2nd Parameter = 2, it skips 2 but starting from 1 as I have entered 1 as the offset paramter in the 4th parameter. I am telling to start the process after 1 (1st element)

 

Fowmy_1-1739096854729.png


Hope I managed to explain 🙂





Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

If param4 defines that the 1rst item selected in the list for List.Alternate (1..10, 1,1,1)   => output list begins with 1

But List.Alternate (1..10, 1,1) =  List.Alternate (1..10, 1,1,0)   what is the item 0 ?

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

March2025 Carousel

Fabric Community Update - March 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors