Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Why can't I simply remove a column?

I have a CSV file with 30 columns.  I no longer need one of the columns so I have removed it.   I then go into PBI and remove the column as well so I don't get errors when I try to refresh.

But now I'm getting errors because the column no longer exists.  I have to go into advance editor in power query and remove all traces of the column.

 

Is there a better way to remove columns?

  • Hi Anonymous ,

     

    I can't think of a better way to do it.

    Guess, you will have to remove traces of it in Advanced Editor only.

     

    Best Regards

    Simran Tuli

4 Replies

  • mahoneypat's avatar
    mahoneypat
    Icon for Microsoft Employee rankMicrosoft Employee

    References to column names is one of the most common errors.  You can edit the M code as you have done, but here are two other suggestions.  

    1. If you used Remove Other Columns, you can just click on the gear icon to open that dialog and close it, and it will update the M code with existing columns.

    2. For some table functions, you can use MissingField.Ignore in the optional 3rd clause to ignore missing columns.

    https://xxlbi.com/blog/safely-removing-columns-power-query/

     

    If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

    Regards,

    Pat

  • camargos88's avatar
    camargos88
    Icon for Community Champion rankCommunity Champion

    Hi Anonymous ,

     

    If you have any step refering to those columns, if need to adjust them.

    Also, you can clean the cache to avoid some errors.

  • simrantuli's avatar
    simrantuli
    Icon for Continued Contributor rankContinued Contributor

    Hi Anonymous ,

     

    I can't think of a better way to do it.

    Guess, you will have to remove traces of it in Advanced Editor only.

     

    Best Regards

    Simran Tuli

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

     

    Steps are inter related sometimes hence you will need to remove the traces of the column you deleted.

     

    Regards,
    Harsh Nathani
    Did I answer your question? Mark my post as a solution! Appreciate with a Kudos!! (Click the Thumbs Up Button)