Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DAX formula to concatenate three columns

I am mew to DAX. How can I concatenate three different columns say First_Name, Middle_Name and Last_Name to a single column with a space in between using CONCATENATE function in DAX. At present I could concatenate only two columns.

=CONCATENATE(FIRST_NAME],CONCATENATE(" ",[LAST_NAME]))

If any other function is there please do let me know that also. My aim is to concatenate 1st Name, 2nd Name and 3rd Name into a single column in SSAS Tabular Model

Please help me. Thanks in Advance

like image 308
user2107971 Avatar asked Mar 04 '14 11:03

user2107971


2 Answers

For anyone coming back to this, particularly if you have more than two variables to concatenate, consider using COMBINEVALUES():

=COMBINEVALUES(<delimiter>, <expression>, <expression>[, <expression>]…)

For the posted question, this would look like:

=COMBINEVALUES(" ", [FIRST NAME], [LAST NAME])

And can be expanded to include additional values after [LAST NAME].

like image 121
Sam Davey Avatar answered Sep 19 '22 12:09

Sam Davey


You can use nested CONCATENATE functions with the & to append your spaces. Following your example:

=CONCATENATE([FIRST NAME]&" ", CONCATENATE([MIDDLE NAME]&" ", [LAST NAME]))
like image 24
userfl89 Avatar answered Sep 23 '22 12:09

userfl89