Monday, June 8, 2020

Power BI - Concatenating strings in DAX

Lets say we have the below data in excel  and we need to concatenate them

So, lets begin , I will do the below steps

1.       Import the data

2.       Create a New Column

Now, I would write a DAX statement to concatenate the First name and Last name as below

 

But we can see that there is no space between firstName & LastName

So, lets try to insert the insert the space

We are getting error because CONCATENATE function of DAX only considers 2 parameters and the moment we add third parameter the function throws error.

In Order to handle such scenario, we make the used of the below DAX operator

So in scenario, wherein we have to merge more then 2 columns we make the used of “&” operator of DAX