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
Hnd12000
Frequent Visitor

Composing text with null values replaced by nothing

I'm trying to compose a text (to define the location of a file) that is made of the combination of Drilled down values (concatenated with "&")

The problem I face is that there are instances when some of this Drill down can be empty.

In Excel concatenating cells that are empty will not add anything but in PowerQuery empty is null and this ruin my formula

Are there any ways to replace this "null" by nothing in my formula ?

1 ACCEPTED SOLUTION
wdx223_Daniel
Super User
Super User

Text.Combine function can ignore the null value in its first parameter.

View solution in original post

4 REPLIES 4

Maybe the solution by @CNENFRNL is more elegant, easier to use in case you have more columns (like I had)?

Table.AddColumn(#"Replaced Value", "Custom", each ([A]??"") & ([B]??"") & ([C]??""))

Solved: Custom column to combine two Colum returns null if... - Microsoft Fabric Community

watkinnc
Super User
Super User

Hey there. You can do this:

NewStep = Table.AddColumn(PriorStepName, "NewColumnName", each if [Column2] = null then [Column1] else [Column1]&[Column2], type text)

 

---Nate


I’m usually answering from my phone, which means the results are visualized only in my mind. You’ll need to use my answer to know that it works—but it will work!!
Fowmy
Super User
Super User

@Hnd12000 


You may try to replace null with blank using:

Fowmy_0-1604175027054.png

 

________________________

If my answer was helpful, please consider Accept it as the solution to help the other members find it

Click on the Thumbs-Up icon if you like this reply 🙂

YouTube  LinkedIn

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

wdx223_Daniel
Super User
Super User

Text.Combine function can ignore the null value in its first parameter.

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.

Top Solution Authors
Top Kudoed Authors