Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more.
Get startedGrow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.
Hello,
I have a very long table with data from past 5 years (almost) everyday on our list of customers.
Uploaded | Customer ID |
1/1/2000 9:00 | 111 |
1/1/2000 9:00 | 222 |
1/1/2000 9:00 | 333 |
1/1/2000 10:03 | 111 |
1/1/2000 10:03 | 222 |
1/1/2000 10:03 | 333 |
1/1/2000 12:24 | 111 |
1/1/2000 12:24 | 222 |
1/1/2000 12:24 | 333 |
1/2/2000 8:00 | 222 |
1/2/2000 8:00 | 333 |
1/2/2000 8:00 | 444 |
etc.
How can I just keep the earliest upload time for each day (only 3 rows of 1/1/2000 9:00 and 3 rows of 1/2/2000 8:00 in the example table) and delete the other duplicate columns?
Thank you!
Solved! Go to Solution.
Hi,
This M code works
let
Source = Excel.CurrentWorkbook(){[Name="Data"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Uploaded", type datetime}, {"Customer ID", Int64.Type}}),
#"Inserted Date" = Table.AddColumn(#"Changed Type", "Date", each DateTime.Date([Uploaded]), type date),
#"Grouped Rows" = Table.Group(#"Inserted Date", {"Date"}, {{"Count", each Table.AddRankColumn(_,"Index","Uploaded")}}),
#"Expanded Count" = Table.ExpandTableColumn(#"Grouped Rows", "Count", {"Uploaded", "Customer ID", "Index"}, {"Uploaded", "Customer ID", "Index"}),
#"Filtered Rows" = Table.SelectRows(#"Expanded Count", each ([Index] = 1)),
#"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"Index"})
in
#"Removed Columns"
Hope this helps.
Hi,
This M code works
let
Source = Excel.CurrentWorkbook(){[Name="Data"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Uploaded", type datetime}, {"Customer ID", Int64.Type}}),
#"Inserted Date" = Table.AddColumn(#"Changed Type", "Date", each DateTime.Date([Uploaded]), type date),
#"Grouped Rows" = Table.Group(#"Inserted Date", {"Date"}, {{"Count", each Table.AddRankColumn(_,"Index","Uploaded")}}),
#"Expanded Count" = Table.ExpandTableColumn(#"Grouped Rows", "Count", {"Uploaded", "Customer ID", "Index"}, {"Uploaded", "Customer ID", "Index"}),
#"Filtered Rows" = Table.SelectRows(#"Expanded Count", each ([Index] = 1)),
#"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"Index"})
in
#"Removed Columns"
Hope this helps.
Thank you Ashish! Would you mind sharing your .pbix file please? I am running into a few errors
here is a workaround for you
Proud to be a Super User!
Hi Ryan, thank you for your response! This works for this sample table but my actual data is from past 5 years with uploads (almost) everyday. It would be time consuming to create a date table with each date and first uploaded time. May I ask for any other ideas?
User | Count |
---|---|
82 | |
77 | |
62 | |
60 | |
49 |
User | Count |
---|---|
109 | |
95 | |
86 | |
79 | |
61 |