Find position number for each group (Table.PositionOf() with Table.Group) in Power Query (M language)
I'd like to find number of position first "TAK" in column "taknie" fo开发者_开发问答r each group (column Grupa).
This is my table.
Grupa | taknie |
---|---|
g1 | NIE |
g1 | TAK |
g2 | NIE |
g2 | NIE |
g2 | NIE |
g2 | TAK |
g3 | TAK |
g3 | TAK |
g3 | NIE |
g3 | TAK |
g4 | NIE |
g4 | TAK |
g4 | TAK |
g5 | NIE |
I've tried in Advanced editor
let
Source = Excel.CurrentWorkbook(){[Name="Tabela1"]}[Content],
Grupa = Table.Group(Source, "Grupa", {"wynik", each Table.PositionOf(
Source,
[taknie = "TAK"],
Occurrence.First,
"taknie"
) + 1})
in
Grupa
but it doesn't work properly:
enter image description here
Instead of 2, 2, 2, 2, 2, should be
Grupa | wynik |
---|---|
g1 | 2 |
g2 | 4 |
g3 | 1 |
g4 | 2 |
g5 | 0 |
精彩评论