Forum Discussion
jimmyhua
Helper I
1 year agouse List.Generate to create a conditional index gave me Expression.Error
I tried to create a conditional index for another list I created. here is the code I wrote and error I got. The first list is to create a position indicator where the index can began. The first one ...
- 1 year ago
use the below formula
let Source = {1,1,2,3,1,2,1,2,3,4,5,1,2,3,1,1,2}, Custom1 = List.Transform(List.Positions(Source), each if Source{_}=1 then _+1 else null) in Custom1result in
jimmyhua
Helper I
1 year agohere is sample list1, which represents a column in a table that I need to group. each 1 starts a new group. I use List.PositionOf to find out the positions where each group starts. Then I want to fill in nulls and use fill down to fill the spaces. I will use the new index column to group the entire table.
{1,1,2,3,1,2,1,2,3,4,5,1,2,3,1,1,2}
lbendlin
Super User
1 year agoPlease show the expected outcome based on the sample data you provided.
- jimmyhua1 year ago
Helper I
I would like to be able to create a list2 like this based on list1
{1,2,null,null,5,null,7,null,null,null,null,12,null,null,15,16,null}
- lbendlin1 year ago
Super User
let list1 = {1,1,2,3,1,2,1,2,3,4,5,1,2,3,1,1,2}, list2 = List.Transform(List.Zip({list1,List.Positions(list1)}), each if _{0}=1 then _{1}+1 else null) in list2 - Omid_Motamedise1 year ago
Super User
use the below formula
let Source = {1,1,2,3,1,2,1,2,3,4,5,1,2,3,1,1,2}, Custom1 = List.Transform(List.Positions(Source), each if Source{_}=1 then _+1 else null) in Custom1result in