Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I'd like to aggregate a table for my dataflow. The table is down below. I'd like to have:
Can I use the option 'Group by' and if so, how?
Solved! Go to Solution.
Hello @PZUDGW
use Table.Group and within the group-function Table.Max to get your desired result. Here an example
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUTI01jM01DMyADHBOFYHKmEBlzACY7iEqZ6hEUTCGIxBEk5AloGFnoGhnqElilEwCSOIBMIoJ4jlBsYQCahRsQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"REFOBJECT ID" = _t, PMCVALIDFROM = _t, PMCRENTAMOUNT = _t, PMCSCORINGPOINT = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"REFOBJECT ID", type text}, {"PMCVALIDFROM", type date}, {"PMCRENTAMOUNT", Int64.Type}, {"PMCSCORINGPOINT", Int64.Type}}, "de-DE"),
#"Grouped Rows" = Table.Group(#"Changed Type", {"REFOBJECT ID"}, {{"LastVALIDFROMROW", each Table.Max(_, "PMCVALIDFROM"), type record}}),
#"Expanded LastVALIDFROMROW" = Table.ExpandRecordColumn(#"Grouped Rows", "LastVALIDFROMROW", {"PMCVALIDFROM", "PMCRENTAMOUNT", "PMCSCORINGPOINT"}, {"PMCVALIDFROM", "PMCRENTAMOUNT", "PMCSCORINGPOINT"})
in
#"Expanded LastVALIDFROMROW"
Copy paste this code to the advanced editor in a new blank query to see how the solution works.
If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too
Have fun
Jimmy
Works great!
Thanks for your help
Hello @PZUDGW
use Table.Group and within the group-function Table.Max to get your desired result. Here an example
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WclTSUTI01jM01DMyADHBOFYHKmEBlzACY7iEqZ6hEUTCGIxBEk5AloGFnoGhnqElilEwCSOIBMIoJ4jlBsYQCahRsQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"REFOBJECT ID" = _t, PMCVALIDFROM = _t, PMCRENTAMOUNT = _t, PMCSCORINGPOINT = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"REFOBJECT ID", type text}, {"PMCVALIDFROM", type date}, {"PMCRENTAMOUNT", Int64.Type}, {"PMCSCORINGPOINT", Int64.Type}}, "de-DE"),
#"Grouped Rows" = Table.Group(#"Changed Type", {"REFOBJECT ID"}, {{"LastVALIDFROMROW", each Table.Max(_, "PMCVALIDFROM"), type record}}),
#"Expanded LastVALIDFROMROW" = Table.ExpandRecordColumn(#"Grouped Rows", "LastVALIDFROMROW", {"PMCVALIDFROM", "PMCRENTAMOUNT", "PMCSCORINGPOINT"}, {"PMCVALIDFROM", "PMCRENTAMOUNT", "PMCSCORINGPOINT"})
in
#"Expanded LastVALIDFROMROW"
Copy paste this code to the advanced editor in a new blank query to see how the solution works.
If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too
Have fun
Jimmy
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.