Power Query Column Transformation

Brass Contributor

Hi, all. I am struggling to find a way to remove "50/50 Romaine" from the "Work Date" column and move that to another column (that I will label "Commodity"). Also - this data has several blocks of data like that pictured but with different "Commodity" names. For example, the block of data below the screenshot has "Broccoli" on top of the "Work Dates". So - Ill need a solution that will adress this issue all the way down the Work Date column.

 

Thanks for any help provided! PaulScreenshot (44).png

3 Replies

@slohombre 

For such sample - duplicate the column and apply date format

image.png

We have errors where are texts. Now let add Commodity column using formula as

    #"Added Custom" = Table.AddColumn(
        #"Changed Type",
        "Commodity",
        each
            try
                if [#"Work Date - Copy"] = null
                then "!NULL!"
                else null
            otherwise [#"Work Date"]
    ),

Now fill it down, replace back !NULL! on null and remove temporary column

image.png

@Sergei Baklan  Thank you! I duplicated the column and did get the errors where the text was formerly located. I am having trouble with the next step, I assume I use the "Custom Column"  button for the formula. Could I get more basic instruction from you on the exact formula to put into the formula bar? Thanks for the help. 

 

Screenshot (45).png 

@slohombre 

Sorry, I copy/pasted that from Advanced Editor since corrected formula here. If in Add Custom Column window it looks like

image.png

You may not care about formatting here and type everything in one string.