Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreWe've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
Hi,
I have a problem where I want to add maximum values from a column (Value) based on conditional criteria from another column (Year.week & Name). My data looks like:
Year.week & Name Value
2019-01; Name1 3
2019-01; Name1 0
2019-01; Name1 0
2019-01; Name2 4
2019-01; Name2 0
2019-01; Name2 0
I would like my output to be like:
Year.week & Name Value
2019-01; Name1 3
2019-01; Name1 3
2019-01; Name1 3
2019-01; Name2 4
2019-01; Name2 4
2019-01; Name2 4
I've tried to merge an if statement with list.max, use fill down function or group but can't get my output the way I want. Help would be much appreciated!
Thnx!
Solved! Go to Solution.
Hi @Anonymous ,
I think the below is what you are after:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwtNQ1MLRW8EvMTTVU0lEyVorVwSJsQLSwEVDYBLswDtVA4VgA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [#"Year.week & Name" = _t, Value = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Year.week & Name", type text}, {"Value", Int64.Type}}),
#"Merged Queries" = Table.NestedJoin(#"Changed Type", {"Year.week & Name"}, #"Changed Type", {"Year.week & Name"}, "Changed Type", JoinKind.LeftOuter),
#"Aggregated Changed Type" = Table.AggregateTableColumn(#"Merged Queries", "Changed Type", {{"Value", List.Max, "Max of Value"}})
in
#"Aggregated Changed Type"
Kind regards,
JB
Hi @Anonymous ,
I think the below is what you are after:
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwtNQ1MLRW8EvMTTVU0lEyVorVwSJsQLSwEVDYBLswDtVA4VgA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [#"Year.week & Name" = _t, Value = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Year.week & Name", type text}, {"Value", Int64.Type}}),
#"Merged Queries" = Table.NestedJoin(#"Changed Type", {"Year.week & Name"}, #"Changed Type", {"Year.week & Name"}, "Changed Type", JoinKind.LeftOuter),
#"Aggregated Changed Type" = Table.AggregateTableColumn(#"Merged Queries", "Changed Type", {{"Value", List.Max, "Max of Value"}})
in
#"Aggregated Changed Type"
Kind regards,
JB
Thanks for your help, much appreciated!
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
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 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
| User | Count |
|---|---|
| 9 | |
| 8 | |
| 7 | |
| 5 | |
| 5 |