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
Anonymous
Not applicable

Bar Chart with multiple Columns as Axis and Count for value

First post here and I've tried searching a few things and I am sure this has been asked but I wasn't sure what the right terms were.  Thank you for all your help so far!

 

I have a sample table below which looks like this:

 

Invoice#Test1Test2Country

1

10US
200US
300US
400US
500Can
601Can
711US
810US
910US
1000US
1111US
1210US
1300Can
1401Can
1511Can

 

 I am looking to create a bar chart that would show the number of 1s in Test 1 and Test 2. So the axis of the chart would show Test1, Test2, while the value of each bar would be the count of 1s or sum of the Test1/2 column.  I can summarize the values into another table but I found that I lost the ability to use a slicer on the country column - this is just a sample data set and the real data set has multiple values I would need to use slicers with so I would need a way to dynamically summarize, which I was not able to find.

 

Thank you for your help!

1 ACCEPTED SOLUTION
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @Anonymous,

 

Do you want to get the output below?

 

bar chart.png

 

If it is, you could folloe the steps below.

 

1. We need do some change for your data model in Query Editor. Upivot columns Test1 and Test2, then you will get the table like below.

after upivot.PNG

 

2. Apply and Close. Create the measure with the formula below.

mea = CALCULATE(COUNTROWS('Table1'),FILTER('Table1','Table1'[Value]=1))

3. Create the Bar chart with Attribute as Axis and measure as value.

 

More details, you could refer to the attachment.

 

If you still need help, please share your desired output so that we could help further on it.

 

Best Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @Anonymous,

 

Do you want to get the output below?

 

bar chart.png

 

If it is, you could folloe the steps below.

 

1. We need do some change for your data model in Query Editor. Upivot columns Test1 and Test2, then you will get the table like below.

after upivot.PNG

 

2. Apply and Close. Create the measure with the formula below.

mea = CALCULATE(COUNTROWS('Table1'),FILTER('Table1','Table1'[Value]=1))

3. Create the Bar chart with Attribute as Axis and measure as value.

 

More details, you could refer to the attachment.

 

If you still need help, please share your desired output so that we could help further on it.

 

Best Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Can you please explain how you made the changes to the data in the query? 

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.