Forum Discussion
jcastr02
Post Prodigy
1 year agoGroup By & logic for historical view
I have a query with three columns Store, Support Type, and Reporting Month. I'd like to be able to show a historical time view of the support type by store and shrink the list when the support type...
- 1 year ago
read about GroupKind.Local
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("ddAxCoQwEEbhq0hqQTNJTNIvtttsJ97A1vu7oJJo5lVTfAz8vGUxdhLTm3nftv+xdrCDjCJm7d8kTKe4VgTFoXiUgDKhRJSEklHsyMQVLvHYRxGH4lFCK12JozxElISSW/l9P7mKo5GS4CalwU2nBOx2SUzl5zm8ltxK166uP16rHyRMuK2sXg8=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Store = _t, #"Support Type" = _t, #"Reporting Month" = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Reporting Month", type date}}), #"Grouped Rows" = Table.Group(#"Changed Type", {"Store", "Support Type"}, {{"Start Date", each List.Min([Reporting Month]), type nullable date}, {"End Date", each List.Max([Reporting Month]), type nullable date}},GroupKind.Local), #"Filtered Rows" = Table.SelectRows(#"Grouped Rows", each ([Support Type] <> " ")) in #"Filtered Rows"How to use this code: Create a new Blank Query. Click on "Advanced Editor". Replace the code in the window with the code provided here. Click "Done". Once you examined the code, replace the entire Source step with your own source.
lbendlin
Super User
1 year agoread about GroupKind.Local
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("ddAxCoQwEEbhq0hqQTNJTNIvtttsJ97A1vu7oJJo5lVTfAz8vGUxdhLTm3nftv+xdrCDjCJm7d8kTKe4VgTFoXiUgDKhRJSEklHsyMQVLvHYRxGH4lFCK12JozxElISSW/l9P7mKo5GS4CalwU2nBOx2SUzl5zm8ltxK166uP16rHyRMuK2sXg8=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Store = _t, #"Support Type" = _t, #"Reporting Month" = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Reporting Month", type date}}),
#"Grouped Rows" = Table.Group(#"Changed Type", {"Store", "Support Type"}, {{"Start Date", each List.Min([Reporting Month]), type nullable date}, {"End Date", each List.Max([Reporting Month]), type nullable date}},GroupKind.Local),
#"Filtered Rows" = Table.SelectRows(#"Grouped Rows", each ([Support Type] <> " "))
in
#"Filtered Rows"
How to use this code: Create a new Blank Query. Click on "Advanced Editor". Replace the code in the window with the code provided here. Click "Done". Once you examined the code, replace the entire Source step with your own source.