Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
amaral_diego
Helper I
Helper I

Help with Concatenate Text in Power BI

Hello everyone,

I’m trying to create a measure in Power BI that concatenates information from two related tables. Specifically, I want to display the phrase “Head: Professional Name (GESTOR)” where “Professional Name” comes from the d_Sócios table and “GESTOR” comes from the f_PRINCIPAL table.

The tables d_Sócios and f_PRINCIPAL are related by the columns Sigla (from d_Sócios) and GESTOR (from f_PRINCIPAL).

It's possible to do that in Power BI?

 

I am not able to get the measure to work correctly.
I've tried with the CONCATENATE, but without success.
Could someone help me correct this code or suggest a better approach?

Also, would it be better to do this with DAX code or by concatenating directly in a text box?

Thank you in advance for your help!

2 ACCEPTED SOLUTIONS

hi @amaral_diego ,

 

then try like:

measure =

MAXX(RELATEDTABLE(d_Sócios),d_Sócios[Professional Name])

&

MAX(f_PRINCIPAL[GESTOR])

View solution in original post

Thanks for your assistance, but I've found another way more familiar to do.

View solution in original post

5 REPLIES 5
Poojara_D12
Memorable Member
Memorable Member

Hi @amaral_diego 
You can use the below DAX:

HeadInfo ="Head: " & SELECTEDVALUE(d_Sócios[Professional Name]) & " (" & LOOKUPVALUE(f_PRINCIPAL[GESTOR], f_PRINCIPAL[Sigla], d_Sócios[Sigla]) & ")"

Explanation

  1. SELECTEDVALUE(d_Sócios[Professional Name]): This function retrieves the Professional Name from the d_Sócios table. SELECTEDVALUE is helpful here as it returns the single value in a context, or blank if there are multiple.

  2. LOOKUPVALUE(f_PRINCIPAL[GESTOR], f_PRINCIPAL[Sigla], d_Sócios[Sigla]): This function looks up the GESTOR value in f_PRINCIPAL based on the matching Sigla in d_Sócios. It will return the value from f_PRINCIPAL if there is a unique match.

  3. Concatenation: The & operator is used to concatenate the strings with custom text as specified.

  • Make sure your relationship between d_Sócios[Sigla] and f_PRINCIPAL[Sigla] is set up correctly in the model.
  • This measure should be placed in a visual that has context for d_Sócios[Sigla] so that SELECTEDVALUE can retrieve the correct Professional Name.

Alternative: Concatenation in a Calculated Column

If you need the result at a row level rather than a measure, you could also create a calculated column instead of a measure, using similar logic.

Let me know if you need further customization!

Give "Kudos" if you find it helpful! Happy Learning!! 🙂

FreemanZ
Super User
Super User

hi @amaral_diego 

 

how are they related?

Supposing d_Sócios is on the one side, try like:

measure =

MAX(d_Sócios[Professional Name])

&

MAXX(RELATEDTABLE(f_PRINCIPAL), f_PRINCIPAL[GESTOR])

I've tried with your code, without success,
they are related many to one
many from GESTOR Column from the table f_PRINCIPAL
one from Sigla Column from the table d_Sócios

I now how to do it in power apps
is something like that
Text = "Head: " & LookUp(d_Sócios, ID = ThisItem.ID, [Nome Profissional]) & " (" & LookUp(f_PRINCIPAL, ID = ThisItem.ID, [GESTOR]) & ")"

I need to know, if is possible to do something similiar on Power BI

hi @amaral_diego ,

 

then try like:

measure =

MAXX(RELATEDTABLE(d_Sócios),d_Sócios[Professional Name])

&

MAX(f_PRINCIPAL[GESTOR])

Thanks for your assistance, but I've found another way more familiar to do.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.