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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

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
Super User
Super User

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!! 🙂

Did I answer your question? Mark my post as a solution, this will help others!
If my response(s) assisted you in any way, don't forget to drop me a "Kudos"

Kind Regards,
Poojara - Proud to be a Super User
Data Analyst | MSBI Developer | Power BI Consultant
Consider Subscribing my YouTube for Beginners/Advance Concepts: https://youtube.com/@biconcepts?si=04iw9SYI2HN80HKS
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!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Feb2025 NL Carousel

Fabric Community Update - February 2025

Find out what's new and trending in the Fabric community.