I know this question is already asked, here is a few links How to count the node a user has created in a View? or How can I count the number of nodes submitted by the current user?

This is a very simple task but I am facing a problem. I'm trying to get the number of nodes of a certain content type created by a user. This is the configuration of the view:

  1. setting Author uid as contextual filter
  2. setting the content type in filter criteria and selecting Node ID as field
  3. setting aggregation to yes and set the nid to use the Count Distinct aggregation
  4. Setting the Pager to Display all items

If I don't use the aggregation this is the result:

2158 2151 2152 2153 2154 2155 2156 2157 2142 2143 2144 2145 2146 2147 2148 2149 2150 2141 2140 2139 2138 2137 2136 2127 2126 2125 2124 2123 2128 2129 2130 2131 2132 2133 2134 2135 2122

But if I use it, the result is :


which 8+15+14 = 37 and number of the nodes is also 37 but I wonder why it displays the 37 this way?

  • It's not clear what the problem is. Are you wanting to display only the total nodes created or total nodes created for each type? What are you expecting it to display by aggregating via counting distinct NIDs?
    – Shawn Conn
    Commented Nov 11, 2015 at 4:55
  • I need to count number of nodes of a certain content type created by a user. I will use nid field, as I said, and use aggregation count distinct
    – M a m a D
    Commented Nov 11, 2015 at 5:02
  • It looks like each row is giving you the count for each node type (e.g. 8 for node type a, 15 for node type b, etc.). Are you expecting it to just return the count of 37?
    – Shawn Conn
    Commented Nov 11, 2015 at 6:16
  • There is only one node type. They are all of type CONTENT_TYPE_A
    – M a m a D
    Commented Nov 11, 2015 at 6:29
  • Anything set in the sorting area? Commented Nov 11, 2015 at 8:17

1 Answer 1


You should make sure that you have no sort criteria set in your view that splits your aggregation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.