Forum Discussion
Tinus1905
2 years agoResolver I
powerbi remove newest time duplicates
Hi, In PowerBi I have a table with duplicate values. I want to remove the duplicates so the oldest would be deleted. You can see that Peter worked on 25-10-2023 13:41 with working hours of 08:0...
- 2 years ago
Tinus1905 open Blad1 in Advanced Editor and replace everything with the following:
let Source = Excel.Workbook(File.Contents("\\dc01\Users\martijnb\Desktop\Hours 2.xlsx"), null, true), Blad1_Sheet = Source{[Item="Blad1",Kind="Sheet"]}[Data], #"Promoted Headers" = Table.PromoteHeaders(Blad1_Sheet, [PromoteAllScalars=true]), #"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Date added", type datetime}, {"Workdate", type date}, {"Name", type text}, {"Starttime", type time}, {"endtime", type time}, {"total changed by manager", type time}, {"Namecode", type text}, {"Factory", type text}}), g = Table.Group(#"Changed Type", {"Workdate", "Name", "Starttime"}, {{"all", each Table.LastN(Table.Sort(_, "Workdate"), 1)}}), combine = Table.Combine(g[all]) in combine
Tinus1905
2 years agoResolver I
AlienSx you can access the file.
I don't quite understand what you mean, but probably when I see it in the file it will become clear.
AlienSx
2 years agoSuper User
Tinus1905 open Blad1 in Advanced Editor and replace everything with the following:
let
Source = Excel.Workbook(File.Contents("\\dc01\Users\martijnb\Desktop\Hours 2.xlsx"), null, true),
Blad1_Sheet = Source{[Item="Blad1",Kind="Sheet"]}[Data],
#"Promoted Headers" = Table.PromoteHeaders(Blad1_Sheet, [PromoteAllScalars=true]),
#"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Date added", type datetime}, {"Workdate", type date}, {"Name", type text}, {"Starttime", type time}, {"endtime", type time}, {"total changed by manager", type time}, {"Namecode", type text}, {"Factory", type text}}),
g = Table.Group(#"Changed Type", {"Workdate", "Name", "Starttime"}, {{"all", each Table.LastN(Table.Sort(_, "Workdate"), 1)}}),
combine = Table.Combine(g[all])
in
combine