Question

Filtering out duplicate values — where is my "count_distinct" function?

  • 8 February 2018
  • 3 replies
  • 5425 views

I’m looking for a way to “count_distinct” values that are not a visible/selected dimension in my look. The function “count_distinct” I feel like would do the job perfectly. However, I get Unknown function “count_distinct” when I try to use it in my table calculation. Any help would be appreciated.



Full disclosure: I’m not particularly technical


3 replies

Userlevel 1

Table calculations can use only dimensions that have been selected from the field picker, which may be causing you an issue if you are trying to count the values not selected. Another possibly reason for count_distinct might not be working is due to what version of Looker you may be operating on.


The count_distinct function was added to table calculations in version 4.2.2, here is a full list and description of all the available mathematical operators and functions in table calcs:







But I think the most direct way to get your desired result would be to create a measure with a type: count_distinct. Here is a good resource for creating count_distinct measures:







If you have further questions feel free to reach out on chat or email us via help.looker.com

I think I just need to buck up and delve into lookml but I am thinking you’re exactly right.



Thanks, Peter!

hi, looking for the same, i would like to filter duplicate data, only present unique data, can any one suggest the the best way to get this



thank you

Reply