cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
New Member

Does Power BI have a COUNT function that counts values in more than one column?

Hi! I have a problem. I have the following type of table

Ava Bor Dop Col
--------------------
Ava        Dop
       Bor  Dop Col
Ava                 
       Bor  Dop

What I want is a horizontal bar chart whose vertical axis are the column headers above and the heights of the bars are the counts of each in the table.  In other words, a bar chart representing the summarized
Variable     COUNT
Ava             2
Bor             2
Dop            3
Col              1

Any help? 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User III
Super User III

Hi @zbisenio ,

 

I would unpivot the columns and filter out the blanks and use it to create my char however if you have this setup you need to add 4 measures:

AVA Measure = CALCULATE(COUNT('Table'[AVA]);'Table'[AVA] <> "")
BOR Measure = CALCULATE(COUNT('Table'[AVA]);'Table'[BOR] <> "")
DOP Measure = CALCULATE(COUNT('Table'[AVA]);'Table'[DOP] <> "")
COL Measure = CALCULATE(COUNT('Table'[AVA]);'Table'[COL] <> "")

 

Then place then on the values of the Clustered bar chart.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog:

Power BI em Português





View solution in original post

2 REPLIES 2
Highlighted
Super User III
Super User III

Hi @zbisenio ,

 

I would unpivot the columns and filter out the blanks and use it to create my char however if you have this setup you need to add 4 measures:

AVA Measure = CALCULATE(COUNT('Table'[AVA]);'Table'[AVA] <> "")
BOR Measure = CALCULATE(COUNT('Table'[AVA]);'Table'[BOR] <> "")
DOP Measure = CALCULATE(COUNT('Table'[AVA]);'Table'[DOP] <> "")
COL Measure = CALCULATE(COUNT('Table'[AVA]);'Table'[COL] <> "")

 

Then place then on the values of the Clustered bar chart.


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog:

Power BI em Português





View solution in original post

Highlighted
Community Support
Community Support

Hi, @zbisenio 

You  can try function  "CountRows" as below:

Ava_measure = COUNTROWS(FILTER('Table','Table'[Ava]<>""))
Bor_measure = COUNTROWS(FILTER('Table','Table'[Bor]<>""))
Col_measure = COUNTROWS(FILTER('Table','Table'[Col]<>""))
Dop_measure = COUNTROWS(FILTER('Table','Table'[Dop]<>""))

You can aslo  use function "CountA", if your column  cell is "null"  rather than  "".

Ava_measure2 = COUNTA('Table (2)'[Ava])
Bor_measure2 = COUNTA('Table (2)'[Bor])
Col_measure2 = COUNTA('Table (2)'[Col])
Dop_measure2 = COUNTA('Table (2)'[Dop])

Please check the attached pbix for more details.

 

Best Regards,
Community Support Team _ Eason

 

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Community Conference

Microsoft Power Platform Communities

Check out the Winners!

secondImage

Create an end-to-end data and analytics solution

Learn how Power BI works with the latest Azure data and analytics innovations at the digital event with Microsoft CEO Satya Nadella.

Top Solution Authors
Top Kudoed Authors