Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Change column name to use other column value

Hi All, I want to change the column name and use other column values The data table is shown below, the name of column SoldQtyLM uses LMdate value 202102, and the name of column SoldQtyMTD uses CMd...
  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi Anonymous ,

    Sorry that I misunderstood your requirement. Please copy and paste the updated codes into your Advanced Editor:

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwMjQwUtKBMIzhDANzINMAjmN1RpXSRGksAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [LMdate = _t, CMdate = _t, CDate = _t, SoldQtyLM = _t, SoldQtyMTD = _t, SoldQtyCD = _t]),
        #"Renamed Columns" = Table.RenameColumns(Source,{{"SoldQtyLM",Source[LMdate]{0}},{"SoldQtyMTD",Source[CMdate]{0}},{"SoldQtyCD",Source[CDate]{0}}})
    in
        #"Renamed Columns"

    Best Regards