Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Need help with Data Cleansing

Hey guys, I need to do some data cleansing and I'm not really sure if this topic needs to be posted here at Power Query or at Dax. I have a table containing the following columns: Personeel.In-/...
  • Vijay_A_Verma's avatar
    4 years ago

    For overwriting the values, DAX can't be used. For this purpose, you will need to use PQ.

    See the working here - Open a blank query - Home - Advanced Editor - Remove everything from there and paste the below code to test (later on when you use the query on your dataset, you will have to change the source appropriately. If you have columns other than these, then delete Changed type step and do a Changed type for complete table from UI again)

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45Wcq0oSS3KU9JRMgJic2NDfXMDQ0M9IAZyDZVidXCrAPLA8okpKSlAtjFI1ghZ1ggsbWIMhECeCYZuI0LGA+2PBQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Personeel.In-/Extern" = _t, #"Uren Registratie 2.CategorieID" = _t, #"WBS Code" = _t, #"Klantnum." = _t]),
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"Personeel.In-/Extern", type text}, {"Uren Registratie 2.CategorieID", Int64.Type}, {"WBS Code", type text}, {"Klantnum.", Int64.Type}}),
        Custom1 = Table.ReplaceValue(#"Changed Type", each [Uren Registratie 2.CategorieID], each if  [#"Personeel.In-/Extern"] = "Extern" and [WBS Code] = "731/7011.01" and [#"Klantnum."] =null then 6 else [Uren Registratie 2.CategorieID], Replacer.ReplaceValue,{"Uren Registratie 2.CategorieID"})
    in
        Custom1