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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Dicken
Responsive Resident
Responsive Resident

let versus record

 

 

Hello, 
can someone explain why the record  version does not give result in genlist; 

 

let  alist = {"a","b","c","c","c","d","d"} ,
 lc = List.Count (alist )
 in 
List.Generate( ()=> [ i =  0 , x = true ] , 
each [i] < List.Count( alist) -1,  
each  [ i = [i]+1, x = alist{[i]} = alist {[i]+1} ]
)

 [ alist =  {"a","b","c","c","c","d","d"} , lc = List.Count (alist )  , 
 genlist = List.Generate( ()=> [ i = 0 , x = true ] , 
 each [i] < lc =1, 
 each  [ i = [i]+1, x = alist{[i]} = alist {[i]+1} ] 
 ) ]

 as a test I also tried ; 

 [alist = {1..10} , 
 b = List.Transform( alist, (A)=> A * 10 ) ]

 

and this does allow  b to work on alist, so I don't see a problem in principal , any solution / explanation. 

Richard. 

1 ACCEPTED SOLUTION
AlienSx
Super User
Super User

what's this? 

each [i] < lc =1

View solution in original post

8 REPLIES 8
AlienSx
Super User
Super User

what's this? 

each [i] < lc =1
Dicken
Responsive Resident
Responsive Resident

thanks, had second look as did not get what you meant, should have been i < lc -1 no = , 

problem solved. 

Dicken
Responsive Resident
Responsive Resident

it's pretty obviuos if you look at the code. .

Dicken
Responsive Resident
Responsive Resident

each value of i  is less than lc 

PwerQueryKees
Super User
Super User

What do you mean by 'Result'. The let statement has an in clause giving a result. The record does not. The record itself is the result.

I suspect you did not give us the full context of the query, so hard to tell what causes any difference.

I mean result  the 'in' statement or the gen of record. 

Ahmedx
Super User
Super User

 Is this what you are looking for?

[  alist = {"a","b","c","c","c","d","d"} ,
 lc = List.Count (alist ),
genlist  = List.Generate( ()=> [ i =  0 , x = true ] , 
each [i] < List.Count( alist) -1,  
each  [ i = [i]+1, x = alist{[i]} = alist {[i]+1} ]
) ][genlist]

 

 

Dicken
Responsive Resident
Responsive Resident

No I'm looking for an answer as to why the let statement gives a result and the record does not 
that was the question asked. .

 

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.