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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
MikeTBX
New Member

Counting Occurrences of Text in Table and Displaying in Column Chart

Hello,

 

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:

 

Colors
Blue
Green, Red
Red, Blue
Yellow
Red
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?

 

Thanks!

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

In the Query Editor, split the column by rows.


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

View solution in original post

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

In the Query Editor, split the column by rows.


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

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.


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

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.