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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Fill In Blank with Results from Another Column

I have 2 columns: createdby_id, NAME. The goal is to fill the NULL (blank) values in the NAME column with the value from the createdby_id. Please see below sample table for reference. 

 

How would you do this? Can this be done without having to create another calculated column? I tried to do this with the replace value function but I don't know how to reference the createdby_id and replace in the NAME column.

 

createdby_idNAMETARGET_OUTCOME
Guest Guest
Guest1 Guest1
krbtgt krbtgt
t.joneTom JonesTom Jones
an.franAnne FrankAnne Frank
meg.foxMegan FoxMegan Fox
1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @Anonymous ,

 

Based on the video from Miguel Escobar (video link)

 

If you do a replace step and then change the text for the column name you should get the expected result.

 

In my example below I first will replace the null for value COLUMNNAME and then replace that by the text you need to place on the formula bar:

 

= Table.ReplaceValue(Source,"","COLUMN NAME",Replacer.ReplaceValue,{"NAME"})

Column_Name.png

Now replace the "COLUMN NAME" by the code highlited below:

= Table.ReplaceValue(Source,"",each _[createdby_id],Replacer.ReplaceValue,{"NAME"})

target.png

 

Check the full code below:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45Wci9NLS5R0oHTSrE6UEFDmKghTDi7KKkkHaQIzgALl+hl5eelAnkh+bkKXkBmMQobpCQxTy+tKDEPKO6Yl5eq4AZkZ6NyQKpyU9P10vIrgBK+qemJeQpuaOzYWAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [createdby_id = _t, TARGET_OUTCOME = _t, NAME = _t]),
    #"Replaced Value" = Table.ReplaceValue(Source,"",each _[createdby_id],Replacer.ReplaceValue,{"NAME"})
in
    #"Replaced Value"

 

Regards,

MFelix


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

1 REPLY 1
MFelix
Super User
Super User

Hi @Anonymous ,

 

Based on the video from Miguel Escobar (video link)

 

If you do a replace step and then change the text for the column name you should get the expected result.

 

In my example below I first will replace the null for value COLUMNNAME and then replace that by the text you need to place on the formula bar:

 

= Table.ReplaceValue(Source,"","COLUMN NAME",Replacer.ReplaceValue,{"NAME"})

Column_Name.png

Now replace the "COLUMN NAME" by the code highlited below:

= Table.ReplaceValue(Source,"",each _[createdby_id],Replacer.ReplaceValue,{"NAME"})

target.png

 

Check the full code below:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45Wci9NLS5R0oHTSrE6UEFDmKghTDi7KKkkHaQIzgALl+hl5eelAnkh+bkKXkBmMQobpCQxTy+tKDEPKO6Yl5eq4AZkZ6NyQKpyU9P10vIrgBK+qemJeQpuaOzYWAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [createdby_id = _t, TARGET_OUTCOME = _t, NAME = _t]),
    #"Replaced Value" = Table.ReplaceValue(Source,"",each _[createdby_id],Replacer.ReplaceValue,{"NAME"})
in
    #"Replaced Value"

 

Regards,

MFelix


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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