Forum Discussion
Group data and create columns for weekdays and Time values
- 2 years ago
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("zZXJCsIwEIZfZeg5atKKbb2JCxZcilY8VA8BFyJpKq2+v3VARIxHyVwmmZDl48vhz3NPiCCMPeYNy+qmLkrrsob1VSrTrI2mM0gHs/lyMV4z2FU7M+zAqJJnWSgjawYiYpCWug2JObQhlboozbGGJMHNr6PY4Ds483kARXO7uWv9HoS3Zy5p5sum8LDPeYtHTSWDFD+RRJcQkughEhFL2YacJUSiZWk7JmcJkWhZyqbkLCESLUuTFTlLiPTDUvTsMlmpk/w3TRD7oSXbfJcolhRxz/P5VU55LPnhnoeQH0tyuOch5MeSGe55CPmxpIV7ni8/+wc=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Postal = _t, #"City Country" = _t, #"Collect Point" = _t, Date = _t, Time = _t, Index = _t]), FilteredRows = Table.SelectRows(Source, each ([Date] <> "null" and [Date] <> null)), GroupedRows = Table.Group(FilteredRows, {"Collect Point", "Date"}, {{"All", each Table.AddIndexColumn(_, "ID", 1, 1, type text), type table}}), CombinedAll = Table.Combine(GroupedRows[All]), AddedPrefix = Table.TransformColumns(CombinedAll, {{"ID", each "Time" & Text.From(_), type text}}) in AddedPrefix
Hi, I'd like to help you, but data in the link you've provided
looks totally different compared to this one:
So how your data looks like?
This query is connected to your Google Drive excel worksheet. I've filtered top 1000 rows to make it faster (it loads 10 519 rows in result). As you can see, it works great. Regarding your issue: There is a problem that you have stored both "times" in Time1 column. Provide data with this issue and I can try to help you.
let
Source = Excel.Workbook(Web.Contents("https://drive.google.com/uc?export=download&id=1htdH3Pd9GRSPRb5xuLJTh1CA7OhbKasH")),
Sheet1_Sheet = Source{[Item="Sheet1",Kind="Sheet"]}[Data],
RenamedColumns = Table.RenameColumns(Sheet1_Sheet,{{"Column1", "Postal City Country"}, {"Column2", "Collect Point"}, {"Column3", "Date Time"}}),
#"!!!_FilteredTOP1000Rows_!!!" = Table.FirstN(RenamedColumns, 1000),
AddedIndex = Table.AddIndexColumn(#"!!!_FilteredTOP1000Rows_!!!", "Index", 0, 1, Int64.Type),
Ad_DateTimeSplit = Table.AddColumn(AddedIndex, "DateTimeSplit", each List.Select(List.Transform(Text.Split([Date Time], "#(lf)"), (x)=> Text.Remove(x, {" ", "#(cr)"})), (y)=> Text.Length(y) > 1), type list),
ExpandedDateTimeSplit = Table.ExpandListColumn(Ad_DateTimeSplit, "DateTimeSplit"),
SplitColumnByDelimiter = Table.SplitColumn(ExpandedDateTimeSplit, "DateTimeSplit", Splitter.SplitTextByEachDelimiter({":"}, QuoteStyle.Csv, false), {"Date", "Time"}),
RemovedColumns = Table.RemoveColumns(SplitColumnByDelimiter,{"Date Time"}),
GroupedRows = Table.Group(RemovedColumns, {"Index", "Date"}, {{"All", each Table.AddIndexColumn(_, "ID", 1, 1, Int64.Type), type table}}),
CombinedAll = Table.Combine(GroupedRows[All]),
Transformed = Table.TransformColumns(CombinedAll,
{ {"Collect Point", each Text.Combine(Text.Split(Text.Remove(_, {",", "#(cr)"}), "#(lf)"), ", "), type text},
{"ID", each "Time" & Text.From(_, "sk-SK"), type text} })
in
Transformed
Hi Dufo,
Final output is time1 and time 2 which is not working for friday,
- dufoq32 years agoCommunity Champion
I'm sorry but I give up. I've asked for data with this issue, but you either not read what i write or you're kidding...
I will not response to this thread anymore. I recommend you to creat new one with sample data covering your issue in usable format and expected result based on sample data.