Forum Discussion
HenningB
5 years agoFrequent Visitor
Append data based on information in third table
Hello everyone! I've tried all sorts of things and have read a few articles around "merging based on date range" but that's not what I want to achieve. I collect two types of tracking informa...
- Anonymous5 years ago
Hi HenningB ,
I created a sample pbix file (see attachment), please check whether that is what you want. If no, please provide your expected result with more details.
Best Regards
lbendlin
5 years agoSuper User
Yes, a table combine should suffice - you would only have to deal with the cargo lookups for the gaps. The assumption would be that the trailer GPS position would always be more accurate than the cargo GPS position, and that the reporting timestamp would be pegged somehow so that both cargo and trailer report "at the same time".
Here's something to get you started. Your sample data is not good enough for more. You may want to include more cargoes etc.
let
Source = Table.Combine({#"Cargo Tracker Table", #"Trailer Tracker Table"}),
#"Sorted Rows" = Table.Sort(Source,{{"Timestamp", Order.Ascending}}),
#"Removed Duplicates" = Table.Distinct(#"Sorted Rows", {"Timestamp"}),
#"Added Custom" = Table.AddColumn(#"Removed Duplicates", "GPS Source", each if [Trailer ID] = null then "Cargo" else "Trailer"),
#"Reordered Columns" = Table.ReorderColumns(#"Added Custom",{"Tracker ID", "Timestamp", "LAT", "LONG", "GPS Source", "Trailer ID"}),
#"Filled Down" = Table.FillDown(#"Reordered Columns",{"Trailer ID"})
in
#"Filled Down"