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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

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
MFelix
Super User
Super User

Hi @Anonymous ,

 

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
v-easonf-msft
Community Support
Community Support

Hi, @Anonymous 

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

 

MFelix
Super User
Super User

Hi @Anonymous ,

 

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



Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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