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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
EmmaX
Frequent Visitor

count specific value in multiple columns

Hello everyone,

 

I'm very new to Power BI so please help me on this.

 

Say I have a table that looks something like this:

 

Capture.PNG

 

and I want to count the number of "yes" in each column, and come out with a table like this:

 

Capture1.PNG

 

so that instead of having three individual bar charts that each shows counts of yes and no, I can make a chart which like this:

 

Capture2.PNG

 

How can I achieve that in power bi?

 

Many thanks!

1 ACCEPTED SOLUTION
Phil_Seamark
Microsoft Employee
Microsoft Employee

Hi @EmmaX

 

You could create a calcuated table that summarizes your raw data

 

Table = SUMMARIZECOLUMNS(
                    'Table1'[Brand],
                    "Comfort",CALCULATE(COUNTROWS('Table1'),'Table1'[comfort]="Yes"),
                    "Affordable Price",CALCULATE(COUNTROWS('Table1'),'Table1'[affordable price]="Yes"),
                    "Ease to Clean",CALCULATE(COUNTROWS('Table1'),'Table1'[ease to clean]="Yes")
                    )

 

This produces the following output based on your sample data.

 

 

summary.png

 


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

View solution in original post

3 REPLIES 3
Phil_Seamark
Microsoft Employee
Microsoft Employee

although this format might be easier to get the barchart you need

 

Table 2 = UNION(
             ROW(
                    "Axis" , "comfort" , 
                    "A" , CALCULATE(COUNTROWS('Table1'),'Table1'[Brand]="A" , 'Table1'[comfort]="Yes"),
                    "B" , CALCULATE(COUNTROWS('Table1'),'Table1'[Brand]="B" , 'Table1'[comfort]="Yes")
                ),
             ROW(
                    "Axis" , "Affordable price" , 
                    "A" , CALCULATE(COUNTROWS('Table1'),'Table1'[Brand]="A" , 'Table1'[affordable price]="Yes"),
                    "B" , CALCULATE(COUNTROWS('Table1'),'Table1'[Brand]="B" , 'Table1'[affordable price]="Yes")
                ),
             ROW(
                    "Axis" , "ease to clean" , 
                    "A" , CALCULATE(COUNTROWS('Table1'),'Table1'[Brand]="A" , 'Table1'[ease to clean]="Yes"),
                    "B" , CALCULATE(COUNTROWS('Table1'),'Table1'[Brand]="B" , 'Table1'[ease to clean]="Yes")
                )
)                 

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Phil_Seamark
Microsoft Employee
Microsoft Employee

Hi @EmmaX

 

You could create a calcuated table that summarizes your raw data

 

Table = SUMMARIZECOLUMNS(
                    'Table1'[Brand],
                    "Comfort",CALCULATE(COUNTROWS('Table1'),'Table1'[comfort]="Yes"),
                    "Affordable Price",CALCULATE(COUNTROWS('Table1'),'Table1'[affordable price]="Yes"),
                    "Ease to Clean",CALCULATE(COUNTROWS('Table1'),'Table1'[ease to clean]="Yes")
                    )

 

This produces the following output based on your sample data.

 

 

summary.png

 


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

Wow, thanks for the quick reply.

 

So it looks like in BI you have to manually code each column...which would be an issue when you have many columns...

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 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.