I seem to have run in to a SOQL error that I'm hoping someone has solved before.

I am creating a dashboard for UserLogins using the [LoginHistory object][1]

The query I am trying to run is:

    SELECT COUNT_DISTINCT(userid) agg 
    FROM loginhistory 
    WHERE logintime = THIS_MONTH 
    AND userid IN ('id1', 'id2', ...)

When I run the query I get back this agg result:

    [ {
      "attributes" : {
        "type" : "AggregateResult"
      },
      "agg" : 1
    } ]

What I need is the number of distinct logins within the time frame, however when I add a GROUP BY UserID salesforce errors:

>  "Grouped field should not be aggregated: UserId"

Query: 

    SELECT userid,COUNT_DISTINCT(userid) agg 
    FROM loginhistory 
    WHERE logintime = TODAY 
    AND userid IN ('id1','id1') 
    GROUP BY userid


  [1]: https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_loginhistory.htm