I suspect it might be but they would be long and complicated; getting consecutive/same dates together would not be trivial! I'm not going to try.
Thank p45cal!
I'm trying to understand the following codes you created in power query. Can you please explain those codes further more? How they work to sort out the consecutive service date and merge them together? Thanks a lots!
-----------------------------------------------
= (tbl)=>
let
Source = tbl,//#"Table1 (2)",
#"Sorted Rows" = Table.Sort(Source,{{"Start date", Order.Ascending}}),
#"Added Index" = Table.AddIndexColumn(#"Sorted Rows", "Index", 1, 1, Int64.Type),
#"Added Custom" = Table.AddColumn(#"Added Index", "ConsecDates", each Number.From([Start date])-[Index]),
#"Grouped Rows" = Table.Group(#"Added Custom", {"ConsecDates"}, {{"grp", each _, type table [Provider=nullable text, Service=nullable text, Customer=nullable text, Start date=nullable date, spending=nullable number, Index=number, ConsecDates=number]}, {"Start", each List.Min([Start date]), type nullable date}, {"End", each List.Max([Start date]), type nullable date}, {"Sum", each List.Sum([spending]), type nullable number}}),
#"Expanded grp" = Table.ExpandTableColumn(#"Grouped Rows", "grp", {"Provider", "Customer"}, {"Provider", "Customer"}),
#"Removed Duplicates" = Table.Distinct(#"Expanded grp"),
#"Removed Columns" = Table.RemoveColumns(#"Removed Duplicates",{"ConsecDates"})
in
#"Removed Columns"
----------------------------------------------