Forum Discussion

Cevola's avatar
Cevola
Helper I
1 year ago
Solved

Pseudonymizing the personal data

Hello all,   I have 2 columns with personal data in my table(Employee ID and Badge ID). I need to provide data to the customer but I cannot share these 2 columns as they contain personal data.   ...
  • PwerQueryKees's avatar
    1 year ago

    Here it is:

    Original table:

    The indexes created. For this sample it runs 1:1, but I assume that in the actual data the same combination of employee id and badge id will occur multiple times:

    The merge:

    The end result:

    All queries:

    // Original Table
    let
        Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"Employee Id", Int64.Type}, {"Start Location", type text}, {"End Location", type text}, {"Start Time", type datetime}, {"End Time", type datetime}, {"Day of the Week", type text}, {"Duration", type time}, {"Badge ID", Int64.Type}})
    in
        #"Changed Type"
    
    // Indexes
    let
        Source = #"Original Table",
        #"Removed Other Columns" = Table.SelectColumns(Source,{"Employee Id", "Badge ID"}),
        #"Removed Duplicates" = Table.Distinct(#"Removed Other Columns"),
        #"Added Index" = Table.AddIndexColumn(#"Removed Duplicates", "Index", 1, 1, Int64.Type)
    in
        #"Added Index"
    
    // End Result
    let
        Source = #"Original Table",
        #"Merged Queries" = Table.NestedJoin(Source, {"Employee Id", "Badge ID"}, Indexes, {"Employee Id", "Badge ID"}, "Indexes", JoinKind.LeftOuter),
        #"Expanded Indexes" = Table.ExpandTableColumn(#"Merged Queries", "Indexes", {"Index"}, {"Index"}),
        #"Removed Columns" = Table.RemoveColumns(#"Expanded Indexes",{"Employee Id", "Badge ID"})
    in
        #"Removed Columns"