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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

Combine Columns in a Measure

I will start by saying we are using an Azure model that i don't have access to change the model to add a calculated column, so i am hoping to figure out a way to do this using a measure as I can create new measures in desktop before publishing to my user group.

 

I have two columns, one called Producer, the other called Package Type.  I want to use a measure (if possible) to combine these two columns in one text string.  example below (from excel) where i have combined Producer and Package with a space in between.

 

Any ideas how to solve?

 

Swinden_0-1629242517576.png

 

1 ACCEPTED SOLUTION
v-eqin-msft
Community Support
Community Support

Hi @Anonymous ,

 

According to your description, it seems that you want to display all combined producer and package values in a Card visual based on the selections selected in the slicer, right?

 

If so , please try the following formula to create a measure:

Measure = 
VAR _t =
    SUMMARIZE ( ALLSELECTED ( 'Table' ), [PACKAGE], [PROCUCER] )
RETURN
    CONCATENATEX ( _t, [PROCUCER] & " " & [PACKAGE], "  ,  ", [PROCUCER], ASC )

 

Here is the final output:

combine all selected values.gif

 

Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

10 REPLIES 10
v-eqin-msft
Community Support
Community Support

Hi @Anonymous ,

 

According to your description, it seems that you want to display all combined producer and package values in a Card visual based on the selections selected in the slicer, right?

 

If so , please try the following formula to create a measure:

Measure = 
VAR _t =
    SUMMARIZE ( ALLSELECTED ( 'Table' ), [PACKAGE], [PROCUCER] )
RETURN
    CONCATENATEX ( _t, [PROCUCER] & " " & [PACKAGE], "  ,  ", [PROCUCER], ASC )

 

Here is the final output:

combine all selected values.gif

 

Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

parry2k
Super User
Super User

@Anonymous no sure what you mean it returns one value, you have to put other two columns in the visual, and this measure then it will work, otherwise there is no solution for this except adding this as a column in the base model.

 

Think about, measures are aggregation and if you are not showing at a row-level data, the measure will not show you each value. Try to understand the basics of how it works, and you will get why you are getting one value. Hope it helps.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Ashish_Mathur
Super User
Super User

Hi,

Drag Producer and Package to a Table visual and write this measure

=min(Data[Producer])&" "&min(Data[Package])

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Thank you Ashish.  This sort of works, but only returns 1 value, I want it to return all values which will be potentially hundreds of records depending on how i apply slicers.  Any ideas?

Hi,

I do not understand what you want.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
VahidDM
Super User
Super User

Hi @Anonymous 

 

Try this measure:

CONCATENATE =
CONCATENATE (
    FIRSTNONBLANK ( 'Table'[Producer], "" ),
    " " & FIRSTNONBLANK ( 'Table'[Package], "" )
)

the output will be as follow:

 

VahidDM_1-1629246151986.png

 

Did I answer your question? Mark my post as a solution!

Appreciate your Kudos VahidDM_0-1629246094483.png !!

Anonymous
Not applicable

Thank you Vahid.  This also sort of works, but only returns 1 value, I want it to return all values which will be potentially hundreds of records depending on how i apply slicers.  Any ideas?

parry2k
Super User
Super User

@Anonymous your measure will be:

 

 

Concatenate = 
COMBINEVALUES(" ", MAX ( Table[Column1] ), MAX ( Table2[Column2] ) )

 

 

Follow us on LinkedIn

 

Check my latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

 

Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Anonymous
Not applicable

Thank you Parry2k.  This works the same as the above two solutions, but only returns 1 value, I want it to return all values which will be potentially hundreds of records depending on how i apply slicers.  Any ideas?

@Anonymous 

 

Can you take a snapshot of your Power BI report and ideal output [or develop it on excel] and share it with us?

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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