Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Replace values of multiple columns using m code power bi

Hi,   I am trying to find and replace values for all the date columns ranging from Jan 2019 to Dec 2024.   I am doing some transformation using if condition, like first select the condition from ...
  • BA_Pete's avatar
    4 years ago

    Hi Anonymous ,

     

    Multi-select (Ctrl+click) all colums that are not your date columns.

    Go to Transform tab > Unpivot Columns > Unpivot Other Columns.

    Perform your replace function on the new [Value] field.

    Re-pivot [Attribute] column using [Value] as population field if you want *.

     

    As a side note, the data structure after you have done the first Unpivot operation is the generally-accepted correct data structure. Having separate columns for each date is unwieldy and will not scale well. Additionally, the structure you currently have will make it very difficult to create relationships and write measures.

     

    Pete