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
AbhiV
Regular Visitor

Count of specific values from a column

I want to show the count of specific value of a column from a table  as my KPI - I have used below function - 

 

CountValues =
CALCULATE ( COUNTROWS ( Sheet1 ), Sheet1[XXX_place] = " open_XXX " ) but the count is showing as 1 instead of actual count. 

 

Please let me know hat is incorrect in it. 

1 ACCEPTED SOLUTION

Is this a measure or a calculated column - you don’t say in the op?  The formula you posted written as a measure will correctly count the instances of “ open_XXX “ (including the spaces either side of the text).  If some of the text doesn’t have spaces either side then those rows will not be counted. You can trim the spaces using Power Query on load.  If that isn’t the problem, then I suggest you set up a test. Create a countrows(table) measure and put it in a visual with the column XXX_place on rows. 



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.

View solution in original post

4 REPLIES 4

Is this a measure or a calculated column - you don’t say in the op?  The formula you posted written as a measure will correctly count the instances of “ open_XXX “ (including the spaces either side of the text).  If some of the text doesn’t have spaces either side then those rows will not be counted. You can trim the spaces using Power Query on load.  If that isn’t the problem, then I suggest you set up a test. Create a countrows(table) measure and put it in a visual with the column XXX_place on rows. 



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.

Thanks for your reply !

 

Yes Its a measure. I am trying to show the infromation as a KPI. The visual that i choosed is Card , after creating this a new column measure with the logic that I have mentioned in the earlier post. Let me try the test you suggested and check the result.

 

 

AbhiV
Regular Visitor

I want to show the count of specific value of a column from a table  as my KPI - I have used below function - 

 

CountValues =
CALCULATE ( COUNTROWS ( Sheet1 ), Sheet1[Defecation_place] = " open_defecation " ) but the count is showing as 1 instead of actual count. 

 

Please let me know hat is incorrect in it. 

http://community.powerbi.com/t5/Desktop/Count-of-specific-values-from-a-column/m-p/328618#M146730



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.

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.