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
andrewmshoe
Frequent Visitor

Concatenate Rows based on Column Value to be used in X-Axis on Graphs

New to Power BI, so bear with me please... I have looked extensively for a solution, and have gotten close, but not quite there.

 

I need to allow an end user to manipulate a data column based on input from a slicer.  Here's some dummy input data:

 

 start.PNG

 

 

I load the data in Power BI and unpivot the category columns to get the following:

 

 Mid.PNG

 

Now, I want the user to be able to check which categories they are interested in getting calculated fields such as AVG Selling Price, AVG Customer Rating, or product count by configuration.

 

slicer.PNG

I am jumping to edit queries to help visualize my thought process with the slicer:

 

filtered.PNG

 

Next I would want to concatenate the rows for each Unique Identifier (i.e. #1 = Cube Small) into an existing additional column.  This concatenated column would be the x-axis for bar graphs, legends for scatter plots, etc...

 

Any ideas?  I created a new measure and used the Concatenatex function, which then could be used in a matrix, but that isn't robust enough.

 

7 REPLIES 7
andrewmshoe
Frequent Visitor

Thank you both for the replies.  Sorry, for not being quite clear enough.

 

Let's pretend there is an engineering team for the size and shape of the widget we sell.  They want to know all of the different configurations of sizes and shapes ordered, how much they each cost on average, and how satisfied the customers are for each configuration.  Here's a sample of a graph they would want:

 

result1.PNG

 

 

 

They don't care about the color or weight so they don't want those to be included in defining all the possible configurations.  Well, another team cares about the shape, color, and weight and all the permutations that exist there.  Same story in terms of requested outputs, but different categories to concatenate.

 

 

This could be done very easily if the requestors were able to edit the dashboard and create a new column concatenating the category columns they are interested in:

 

result2.PNG

 

At this point they could use "NEW COLUMN" as the x-axis in graphs or whatever.  However, this will eventually be published online so they won't have the ability to self-service the tool in this way.  I need a way that allows them to dynamically modify a column based on a slicer.

 

This is where the strategy of unpivoting comes into play.  Now the Categories are in one column and a slicer can be used to filter the data.  To get the equivalent of the "NEW COLUMN" with this strategy, I need to concatenate the value column for each unique identifier.  

 

So if the engineering team slices the data like this:

slicer.PNG

The NEW COLUMN would get calculated to be this:

 

ersul3.PNG

 

Then I would use the NEW COLUMN as the x-axis/legend/etc... for my visuals.

 

 

Hi @andrewmshoe,

 

I create a calculated to achieve your goal.

 

Column = CALCULATE(CONCATENATEX(Table1,Table1[value], " "),ALLEXCEPT(Table1,Table1[id]))

123.PNG

 

For more details, please check the pbix as attached.

 

Regards,

Frank

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

Hi Frank,

 

Thank you for the reply.  I have been away from my computer for a few days so I apologize for the slow response.

 

I tried your solution and it appears to be static instead of dynamic which I require.  See below:

 

new1.PNG

 

 

I make a bar graph to show average selling price by "Column"

 

new2.PNG 

 

At this point I create a filter on "Attribute" but the bar graph does not update:

 

new3.PNG

 

I need the "Column" column to dynamically update based on the slicer selection.  Do you know of a way to do this?

I would like to attach my dummy data file shown in the previous post, but I do not see an option to upload the file. I am assuming my forum rank prohibits attaching anything.  

 

I will not be able to use dropbox/one drive to send a link to the upload either.

Hi @andrewmshoe,

 

Does that make sense? If so, kindly mark my answer as a solution to close the case.

 

Regards,
Frank

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.
v-frfei-msft
Community Support
Community Support

Hi @andrewmshoe,

 

Could the formula be used for you? If not, kindly share your excepted result to me.

 

Column = CONCATENATE(yourtable[Unique Identifier],yourtable[Attribute])

Regards,

Frank

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.
Greg_Deckler
Super User
Super User

Can you show an example of what you are trying to achieve. I didn't get that from your message.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

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.