我有一个表,看起来像这样:
Id GroupId指示符布尔值1 A Intl Y 2 B Dom N 3 A Intl N 4 A Intl N 5 B Dom Y 6 A Intl N 7 C Intl N 8 C Intl N
如果一个转换会改变我的布尔值,我需要做什么,如下所示:如果一个带有“GroupId”指示符的GroupId至少有一行的布尔值为Y,那么所有具有相同Intl的行都将得到Y。
我的最后一个表应该如下所示,其中Ids 3、4和6的布尔值被更改为Y。
Id GroupId指示符布尔值1 A国际Y 2 B Dom N 3 A国际Y 4 A国际Y 5 B Dom Y 6 A国际Y 7 C国际N 8 C国际N
任何帮助都将不胜感激。
发布于 2019-11-26 03:36:31
下面的代码应该可以工作:
let
Source = Excel.CurrentWorkbook(){[Name="Table"]}[Content],
group = Table.Group(Source, {"GroupId"}, {"temp", each let x = List.Contains([Boolean],"Y")
in if x then Table.ReplaceValue(_,each [Indicator] = "Intl",0,(a,b,c)=>if b then "Y" else a,{"Boolean"}) else _}),
combine = Table.Sort(Table.Combine(group[temp]),{"Id", 0})
in
combine
https://stackoverflow.com/questions/59035588
复制相似问题