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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
dwedding3
Frequent Visitor

Help creating a bar graph that counts values found in strings

Hello!

Here's the issue I'm having:
So I have a column that contains multiple values in each cell, and I need to measure the total number of times a specific value appears in said column.

 

For example, a column contains the colors of a flag.

America: red|white|blue
UK: red|white|blue
Ukraine: blue|yellow
Mexico: red|white|green

how can I get a graph that finds the number of times a single color appears, such as:
Red: 3
white: 3
blue: 3
yellow: 1
green: 1

Thanks

1 ACCEPTED SOLUTION
kpost
Super User
Super User

In Power query, add a column like this:
= Text.Split([Flag_Colors], "|")

Expand the list column.

Add a column with the value 1.

Sum that column in your visual with the Color name as the legend value or as a column in the table or whatever the case may be.

IF this messes with other data in your report, then make a copy of the table first and then do this. 

View solution in original post

1 REPLY 1
kpost
Super User
Super User

In Power query, add a column like this:
= Text.Split([Flag_Colors], "|")

Expand the list column.

Add a column with the value 1.

Sum that column in your visual with the Color name as the legend value or as a column in the table or whatever the case may be.

IF this messes with other data in your report, then make a copy of the table first and then do this. 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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