Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
danielvidal
New Member

How changing the some of the values of a column (null) to the other values of the column condition

Hi,

 

I have 2 columns, first one, same value ( PO #) the other one 2 values (null) and a SO #. How can I change the value of null to be the same as the SO..considering there may be hundreds of POs and hundreds of scenarios in which there's a null value

 

PCPV

PC210639NO PV
PC210639NO PV
PC210639NO PV
PC210639NO PV
PC210639PV210560
PC210639PV210560
PC210639PV210560
PC210639PV210560
PC210639PV210560
PC210639PV210560
PC210639PV210560
PC210639PV210560
PC210639PV210560
PC210639PV210560
PC210639PV210560
PC210639PV210560
PC210639PV210560
PC210639NO PV
PC210639NO PV
PC210639NO PV
PC210639NO PV
PC210639PV210560
PC210639PV210560
PC210639PV210560
PC210639PV210560
PC210639PV210560
PC210639PV210560
PC210639PV210560
PC210639PV210560
PC210639PV210560
PC210639PV210560
PC210639PV210560
PC210639PV210560
PC210639PV210560

 

I have tried tones of things but I don't know how to tell power query to do this automatically for all cases

 

Cheers

1 ACCEPTED SOLUTION
v-yalanwu-msft
Community Support
Community Support

Hi, @danielvidal ;

If i understand right , you could add a conditional column.

vyalanwumsft_1-1663142567945.png

 

Then delete orginal column.

vyalanwumsft_2-1663142585940.png

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCnA2MjQwM7ZU0lHy81cICFOK1aGmYEAYkGlqZjAqTpr4aFwMsLgCSigqYJNGCMQCAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"PO #" = _t, #"SO #" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"PO #", type text}, {"SO #", type text}}),
    #"Added Conditional Column" = Table.AddColumn(#"Changed Type", "Custom", each if [#"PO #"] = " " then [#"SO #"] else [#"PO #"]),
    #"Removed Columns" = Table.RemoveColumns(#"Added Conditional Column",{"PO #"})
in
    #"Removed Columns"

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-yalanwu-msft
Community Support
Community Support

Hi, @danielvidal ;

If i understand right , you could add a conditional column.

vyalanwumsft_1-1663142567945.png

 

Then delete orginal column.

vyalanwumsft_2-1663142585940.png

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WCnA2MjQwM7ZU0lHy81cICFOK1aGmYEAYkGlqZjAqTpr4aFwMsLgCSigqYJNGCMQCAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"PO #" = _t, #"SO #" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"PO #", type text}, {"SO #", type text}}),
    #"Added Conditional Column" = Table.AddColumn(#"Changed Type", "Custom", each if [#"PO #"] = " " then [#"SO #"] else [#"PO #"]),
    #"Removed Columns" = Table.RemoveColumns(#"Added Conditional Column",{"PO #"})
in
    #"Removed Columns"

If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community


Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors