Forum Discussion
countrow in power query whitout help table in M language
- 1 year ago
= Table.AddColumn(Source, "Count", each List.Count(List.Select(Source[code],(x)=>x=[code])))
To paste into Advanced Editor:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSszJVNJRMlKK1YlWKkqtSgRyjMGcrPyMPLhMcWJRIoQTCwA=", BinaryEncoding.Base64), Compression.Deflate)),{"name","code"}),
AddCustom = Table.AddColumn(Source, "Count", each List.Count(List.Select(Source[code],(x)=>x=[code])))
in
AddCustom
yes
| name | code |
| ali | 2 |
| reza | 3 |
| john | 2 |
| sara | 2 |
result:
| name | code | |
| ali | 2 | 3 |
| reza | 3 | 1 |
| john | 2 | 3 |
| sara | 2 | 3 |
- p45cal1 year ago
Solution Supplier
= Table.AddColumn(Source, "Count", each List.Count(List.Select(Source[code],(x)=>x=[code])))
To paste into Advanced Editor:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WSszJVNJRMlKK1YlWKkqtSgRyjMGcrPyMPLhMcWJRIoQTCwA=", BinaryEncoding.Base64), Compression.Deflate)),{"name","code"}),
AddCustom = Table.AddColumn(Source, "Count", each List.Count(List.Select(Source[code],(x)=>x=[code])))
in
AddCustom