Power Query copy from Status2 to Status1

Mohammednt0
4StarLounger
Posts: 456
Joined: 05 Dec 2016, 13:48

Power Query copy from Status2 to Status1

Post by Mohammednt0 »

Good Day

by using power query,

how to copy from Status2 to Status1 only if there is value in Status 2 Without adding any other column just copy or replace, is this possible?

Image


file is attached
You do not have the required permissions to view the files attached to this post.

User avatar
hamster
StarLounger
Posts: 58
Joined: 10 Mar 2021, 22:57

Re: Power Query copy from Status2 to Status1

Post by hamster »

try

Code: Select all

// Table1
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    RV =
        Table.ReplaceValue(Source, each [Status1],
            each if [Status2] = null then Text.Trim([#"Status2(Status1)"]) else Text.Trim([Status2]),
            Replacer.ReplaceText,
            {"Status1"}
        )
in
    RV
hamster.png
You do not have the required permissions to view the files attached to this post.

Mohammednt0
4StarLounger
Posts: 456
Joined: 05 Dec 2016, 13:48

Re: Power Query copy from Status2 to Status1

Post by Mohammednt0 »

it worked like magic , thanks a lot. u made my day.

User avatar
hamster
StarLounger
Posts: 58
Joined: 10 Mar 2021, 22:57

Re: Power Query copy from Status2 to Status1

Post by hamster »

You are welcome :cheers: