Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

New Member

Counting Occurrences of Text in Table and Displaying in Column Chart



I'm trying to figure out how to display data in a particular way and can't figure out the combo of measures and options to get it done. This would be a similar example of what I have:


Green, Red
Red, Blue
Blue, Yellow, Red


What I'd like to do is display a column chart that counts how many cells contain a particular color. So along the x-axis it would have Blue (value of 3), Green (value of 1), Red (value of 4), Yellow (Value of 2).


If I just do the simplest thing and create a column chart with Colors on the x-axis and "count of colors" on the y-axis, it creates 6 different columns 1 high of "Blue"; "Green, Red"; "Red, Blue"; etc.


I've tried creating another data table that just lists the individual colors, set a relationship back to the original column, and then set the individual colors along the axis. That successfully filters to just the individual colors, "Blue", "Green", "Red", and "Yellow", but it only counts the unqiue occurrences when it is the only color listed. So "Blue" displays as 1 because it counts "Blue", but not "Red, Blue" or "Blue, Yellow, Red".


Alternatively, I've created new calculated columns in the data table that does a search for each term and can let me sum that column to get the accurate numbers ... but then I don't know what to put on the X-Axis.


At this point I'm so far deep in the rabbit hole I can't see the forrest for the trees. Don't know what to try next. Any suggestions?



Super User
Super User


In the Query Editor, split the column by rows.

Ashish Mathur

View solution in original post

Super User
Super User


In the Query Editor, split the column by rows.

Ashish Mathur

Thanks Ashish! This did ultimately get me to what I wanted to do.


I was so focused on using a measure or counter or something with filters that I didn't think to create a new table just for this specific purpose. I have other columns and functions on my data where I couldn't create new rows without it messing up other calculations. However, using the same source data I create a new table just to get the color counts.


Created a new table from the same source document, removed the columns I wouldn't need, split the "Colors" column with the comma delimiter into new rows, and then I could do counts and match things up just fine. I created a relationship back to the third table that just has the list of colors with a one-to-many relationship that I can put along the X-axis and now I'm golden. It's doing the calculations right and helping me digest the data in a way I want to see it.



Thanks again!

You are welcome.

Ashish Mathur

Helpful resources

PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors