Expand all | Collapse all

Distinct Count

  • 1.  Distinct Count

    Posted 06-11-2019 07:49
    Is there a way to do a distinct count with mapd crossfilter. 
    dimension.groupAll().reduceCount(column) - will count all occurrences of a number but I need to do a distinct count.

  • 2.  RE: Distinct Count

    Posted 06-12-2019 06:33
    Hi @Yaw Adu-Gyamfi

    I've asked our front-end team to take a look, they should get back to you shortly.


  • 3.  RE: Distinct Count

    Posted 06-14-2019 08:27
    Hi @Yaw Adu-Gyamfi

    One of our frontend engineers suggested the following:

    > the .sizeAsync() method on a crossfilter dimension or group is probably what they are looking for. That will run an APPROX_COUNT_DISTINCT()​

    If this doesn't do what you need, please let me know and we can pursue another solution.


  • 4.  RE: Distinct Count

    Posted 06-17-2019 14:58
    Not sure if I am implementing it rightly, but crossfilter.groupAll().sizeAsync(column') throws a TypeError: group.valueAsync is not a function

  • 5.  RE: Distinct Count

    Posted 06-18-2019 10:47
    Hi @Yaw Adu-Gyamfi !

    First of all, are you connected successfully with crossfilter and able to run other methods? That is, you've done `crossfilter​(connector, "table")` or `crossfilter.setDataAsync(connector, "table")`?

    After making sure of that, if what you are trying to do is get the distinct count of a certain column with name 'column_name', you can try this: `crossfilter.dimension("column_name").group().sizeAsync()`

  • 6.  RE: Distinct Count

    Posted 06-18-2019 11:02
    @Jonathan Rajavuori, thanks for the reply.
    Yes! I have successfully connected with crossfilter and already have some plots. I am able to group and find averages with: crossfilter.dimension('column_1').group().reduceAvg('column_2')`.
    However, I can't use this to get the unique count
    : crossfilter.dimension("column_name").group().sizeAsync()​. I still get a TypeError: 'group.valueAsync is not a function'