Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now
Hi,
I have to grouped accumulations ;
A ; which does not work ;
= Table.Group(Source, {"Name", "Item"},
{{"Count", each
List.Generate( ()=> [ x = 0 , y = [Unit] {0} ] ,
each [x] < List.Count( [Unit] ) ,
each [ x = 0 , y = [y] + [Unit] {x} ] ,
each [y] )
} } )
and B; which does;
Table.Group(Source, {"Name", "Item"}, {{"Count", (i)=>
List.Generate( ()=> [ x = 0 , y = i[Unit] {0} ],
each [x] < List.Count( i [Unit] ) ,
each [ x = [x] + 1, y = [y] + i [Unit] {x} ] ,
each [y] )
}} )
As can be seen if defined the function (i)=> in the second, so is the first refering to an 'outside' table, while the 'each' in
generate is specifically whats going on within the List.Generate , so where both are each it gets confused and causes an error
or something like that ?
Rchard.
Solved! Go to Solution.
The each keyword is a syntax sugar, which is a shorthand form of "(_) =>". In the first case, only the each keyword is used. The program will find whether there is a Unit column in the variable (identifier) named "_" in the nearest layer.
The key point is:
The each keyword is a syntax sugar, which is a shorthand form of "(_) =>". In the first case, only the each keyword is used. The program will find whether there is a Unit column in the variable (identifier) named "_" in the nearest layer.
The key point is:
You have it correct.
Thanks, it took a while for the penny to drop when I kept getting an
error, at first I used a let statement, and named the [Units] and then I could use the name.
in generate.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 2 |
| User | Count |
|---|---|
| 11 | |
| 10 | |
| 7 | |
| 7 | |
| 6 |