Forum Discussion
joshua1990
Post Prodigy
4 years agoTRUE FALSE if group contains value
Hi experts! I would like to get a TRUE/FALSE if a group contains a specific value. The structure is like this: Order Nr Value TRUE / FALSE 100 A TRUE 100 B TRUE 102 A FALSE ...
- 4 years ago
Group by Order; then aggregate by the testing if the Value in each group contains "B":
let //change next line to reflect your actual source of data Source = Excel.CurrentWorkbook(){[Name="Table5"]}[Content], #"Changed Type" = Table.TransformColumnTypes(Source,{{"Order Nr", Int64.Type}, {"Value", type text}}), #"Grouped Rows" = Table.Group(#"Changed Type", {"Order Nr"}, { {"Grouped", each _, type table [Value=nullable text]}, {"TRUE/FALSE", each List.Contains([Value],"B"), type logical} }), #"Expanded Grouped" = Table.ExpandTableColumn(#"Grouped Rows", "Grouped", {"Value"}, {"Value"}) in #"Expanded Grouped"
ronrsnfld
Super User
4 years agoGroup by Order; then aggregate by the testing if the Value in each group contains "B":
let
//change next line to reflect your actual source of data
Source = Excel.CurrentWorkbook(){[Name="Table5"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Order Nr", Int64.Type}, {"Value", type text}}),
#"Grouped Rows" = Table.Group(#"Changed Type", {"Order Nr"}, {
{"Grouped", each _, type table [Value=nullable text]},
{"TRUE/FALSE", each List.Contains([Value],"B"), type logical}
}),
#"Expanded Grouped" = Table.ExpandTableColumn(#"Grouped Rows", "Grouped", {"Value"}, {"Value"})
in
#"Expanded Grouped"