Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
I have the following table
Number Area Infotipo Tp.info Amount Firt Last
100035 AB 40 1 1.000.000,00 04/05/2021
100035 AB 40 1 500.000,00 23/04/2021 03/05/2021
100035 AB 40 1 400.000,00 23/04/2020 22/04/2021
I need the value below
Number Area Infotipo Tp.info Amount Firt Last First Date
100035 AB 40 1 1.000.000,00 04/05/2021 23/04/2020
100035 AB 40 1 500.000,00 23/04/2021 03/05/2021 23/04/2020
100035 AB 40 1 400.000,00 23/04/2020 22/04/2021 23/04/2020
Dear Vejah
Thanks for your reply
There are some information that i dindt give before
The first Date should be de firt date if the the lines are consecutive.
Follow my excel
See the working here - Open a blank query - Home - Advanced Editor - Remove everything from there and paste the below code to test (later on when you use the query on your dataset, you will have to change the source appropriately. If you have columns other than these, then delete Changed type step and do a Changed type for complete table from UI again)
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("fc7NCcAgDAbQXTwL+TOtPbZriPuv0SRSD6VVMHyEPJLWEiGiaMrpvKwUtEL+MZ4lhQKM7M3U8y/QZ96mxcGwMuwCli9omV9yW9xYwaYpgsAazTsPNxxBPEyz/xsFGnsUauzpNw==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Number = _t, Area = _t, Infotipo = _t, Tp.info = _t, Amount = _t, First = _t, Last = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Number", Int64.Type}, {"Area", type text}, {"Infotipo", Int64.Type}, {"Tp.info", Int64.Type}, {"Amount", Int64.Type}, {"First", type date}, {"Last", type date}}),
#"Grouped Rows" = Table.Group(#"Changed Type", {"Number"}, {{"First Date", each List.Min([First]), type nullable date}}),
#"Merged Queries" = Table.NestedJoin(#"Changed Type", {"Number"}, #"Grouped Rows", {"Number"}, "Grouped Rows", JoinKind.LeftOuter),
#"Expanded Grouped Rows" = Table.ExpandTableColumn(#"Merged Queries", "Grouped Rows", {"First Date"}, {"First Date"})
in
#"Expanded Grouped Rows"