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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Dexter1088
Regular Visitor

Combine Rows in 1 Column when keeping the other columns the same

Hi There,

 

Can anyone help me with combining rows in a column? 
I want the data to be the same in all the other columns.

Example: (Combine Office Column)

NameOfficePhone
DougOH111
MattPA222
SteveIN333
DougMO111
MattOH222
SteveCA333
DougIN111
MattMI222
SteveMO333


Formatted to look like this:

NameOfficePhone
DougOH, MO, IN111
MattPA, OH, MI222
SteveIN, CA, MO333



Thanks!

 

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

Try these measures

=CONCATENATEX(VALUES(Data[Office]),Data[Office],",")

=min(Data[Phone])

Hope this helps.

Untitled.png


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

View solution in original post

4 REPLIES 4
Ashish_Mathur
Super User
Super User

Hi,

Try these measures

=CONCATENATEX(VALUES(Data[Office]),Data[Office],",")

=min(Data[Phone])

Hope this helps.

Untitled.png


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

Hi @Dexter1088 ,

Like this? Learned this from Matt Allington's book.

[Combine Office] = IF(HASONEVALUE(CombineOffice[Office]),VALUES(CombineOffice[Office]), CONCATENATEX(VALUES(CombineOffice[Office]),CombineOffice[Office],", "))
If this solves your question, please mark it as the solution.
 

combine office.PNG





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

Proud to be a Super User!




Maybe I'm doing it wrong, but when I do that I get this

NameOfficePhoneCombined Office
DougOH, MO, IN111OH, PA, IN, MO, CA, MI
MattPA, OH, MI222OH, PA, IN, MO, CA, MI
SteveIN, CA, MO333OH, PA, IN, MO, CA, MI


It just shows all the possibilites on every row. Thanks!


Hi @Dexter1088 ,

 

Are you building this in a measure, and if so what are you using to display this? I used your original data to build my table in Power BI.  I then created the measure from above and added it to the matrix shown above turning off the subtotals to get that picture.  How are you trying to display this?

 

If you are trying to place this in the original data table, it won't work as it violates data rules having one piece of data in each cell. 

If this solves your question, please mark it as the solution.

@Nathaniel_C 

 

original data.PNG





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

Proud to be a Super User!




Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors