Help with data counts in mapd charting


#1

I need a data count that is x / y, where x is count(x) and y is approx_count_distinct(y) but have no clue how I can do this… Separately, I have no problem with the count(x) ad the approx_count_distinct(y) data counts, just together, it is killing me.


#2

Howdy:

Arrghh - I apologize - I answered in the context of Mapd Immerse - You are asking how to do this using the MapD charting library. My bad.


I think a custom measure will work. Under measures, choose Custom SQL Measure. Enter the formula as you have it above. For example, count(product)/approx_count_distinct(price)

Custom measures are documented here.

https://www.mapd.com/docs/latest/immerse-user-guide/dimensions-and-measures/#custom-measures

I hope that helps!


#3

And here is the syntax in case you need it. You can directly put this in the custom measures and it will work eg count(col a) / approx_count_distinct(col b)

Not you dont have to specify the group by because the grouping is done by the dimension you pick.