cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
vitexo87 Member
Member

concatenate values

I need to unite the values of fields of type text in two different tables, how can I do?

1 ACCEPTED SOLUTION

Accepted Solutions
Moderator v-sihou-msft
Moderator

Re: concatenate values

Hi @vitexo87,

 

You can nested CONCATENATE() within CONCATENATE() to add concatenate more characters you need.

 

CONCATENATE(string_expression,CONCATENATE(string_expression,string_expression))

 

Regards,

7 REPLIES 7
Super User
Super User

Re: concatenate values

Well it depends. Are the tables related?  Are you writing a measure or a calc column?  Why do you want to do this - IE what are you trying to achieve and why?



* Matt is a Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
vitexo87 Member
Member

Re: concatenate values

The tables are related and I'm wanting to apply to a measure

Super User
Super User

Re: concatenate values

Ok, you assuming you are writing a measure over your data table, you can use the RELATED() function to do what you want. https://msdn.microsoft.com/en-us/library/ee634202.aspx

 

If you are writing a measure over a lookup table, there is a RELATEDTABLE function, but this may be an issue as it will return multiple rows of data.



* Matt is a Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.
Moderator v-sihou-msft
Moderator

Re: concatenate values

Hi vitexo87,

 

If these two tables are related, you can use LOOKUPVALUE() function to import the expected column into current table based on the related column. And concatenate it with existing column.

 

=CONCATENATE(table1[Column],

LOOKUPVALUE(table2[ExpectColumn],table2[RelatedColumn],table1[RelatedColumn])

)

 

Then involve this calculated column in your measure.

 

Reference:
LOOKUPVALUE Function (DAX)

CONCATENATE Function (DAX)

 

Regards,

 

vitexo87 Member
Member

Re: concatenate values

What if I need to add a character in the middle of the information that will be formed, for example a "-"?

Moderator v-sihou-msft
Moderator

Re: concatenate values

Hi @vitexo87,

 

You can nested CONCATENATE() within CONCATENATE() to add concatenate more characters you need.

 

CONCATENATE(string_expression,CONCATENATE(string_expression,string_expression))

 

Regards,

Highlighted
DSimma Regular Visitor
Regular Visitor

Re: concatenate values

I would usually just do the excel way ie. =(Value1)&" - "&(Value 2), I find it quicker and easier then using a function.