Forum Discussion

AbhiV's avatar
AbhiV
Regular Visitor
8 years ago
Solved

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. 

  • 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. 

4 Replies

  • MattAllington's avatar
    MattAllington
    Icon for Community Champion rankCommunity Champion

    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. 

    • AbhiV's avatar
      AbhiV
      Regular Visitor

      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's avatar
    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.