Forum Discussion

vsolanon's avatar
vsolanon
Frequent Visitor
6 years ago
Solved

Power Query combining NULL values

Hi Experts,

I am creating my fist PowerBi which is linked to SharePoint lists. I have a column within the SP List named "Author" which is a Person column. Due to this, when I changed the properties to "Fist Name and Last Name", I got two different columns.

 

 

 

 

Since I want to display the two columns in one field, I created a a new column named "Author" (the one that is highlighted in the above image) using the below formula.

ColumnCreated= [Author.FistName]& " "& [Author."LastName]

 

My main issue is that when I combine both columns, I got a null value since one of the columns combine is null.  Could you please guide me through to know how this can be fix. In case a column is null, I would like to only display the next that has a value.

Kindly note I have tried using "isblank" and "if" statement wihout success. Also, the order of the column cannot be change since I need to display first the name and then the last name.

 

Thank you in advance!

  • Use the following logic in Power Query:

     

     

    = [Column1] & (if [Custom] = null then "" else [Custom])

     

     

     

    It is critical you wrap the if/then/else construct in parentheses, or you'll get an error about a literal being expected. This will return the entire if/then/else as a literal, then allow you to concatenate with your other column.

     

    Then mark that new column as text, and bring it into Power BI's DAX model.