General

Expand all | Collapse all

Distinct Count

  • 1.  Distinct Count

    Posted 15 days ago
    Is there a way to do a distinct count with mapd crossfilter. 
    Currently,
    dimension.groupAll().reduceCount(column) - will count all occurrences of a number but I need to do a distinct count.
    #Charting


  • 2.  RE: Distinct Count

    Posted 14 days ago
    Hi @Yaw Adu-Gyamfi

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

    Best,
    Randy​


  • 3.  RE: Distinct Count

    Posted 12 days ago
    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.

    Best,
    Randy


  • 4.  RE: Distinct Count

    Posted 9 days ago
    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 8 days ago
    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 8 days ago
    @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'