Counting total of different textual values in a column

The dataset has a colum with three distinct values - <10, >10 and No. 

How do I get the count the total for each value?

Solved Solved
0 1 5,439
1 ACCEPTED SOLUTION

Hi @Minesh_Barot

If we wanted to use table calculations, we could use an if statement to determine if the line item in the column is equal to our distinct value, if it is, we can return a 1, else we return a 0. Then, we wrap this in a sum to get the total count. We would have to do this for each value. 

 

538a2d78-c5af-432f-8008-4a2a42d7244c.png

An alternative to do this in the Explore, would be to use a custom measure, where we create a filtered measure that counts a field if the filter condition is true. This would be similar to a traditional filtered measure we can define in LookML. 

dc633646-c226-451e-874e-19fe0f9c77dd.png

The other option would be to create a type: count measure and just select your column as a dimension and the type count measure. This way we get a count grouped by the values in the dimension column. 

1ff57cea-a432-4ff3-9fdd-fe331c66420c.png

We can also do this in the explore, if we create a custom measure type count distinct on a primary key and then select the column you would like to group the count by. 
 

b0201149-ae59-4aad-8411-f552171fc335.png

Please let us know if you have any questions!

Thanks,

Eric

View solution in original post

1 REPLY 1

Hi @Minesh_Barot

If we wanted to use table calculations, we could use an if statement to determine if the line item in the column is equal to our distinct value, if it is, we can return a 1, else we return a 0. Then, we wrap this in a sum to get the total count. We would have to do this for each value. 

 

538a2d78-c5af-432f-8008-4a2a42d7244c.png

An alternative to do this in the Explore, would be to use a custom measure, where we create a filtered measure that counts a field if the filter condition is true. This would be similar to a traditional filtered measure we can define in LookML. 

dc633646-c226-451e-874e-19fe0f9c77dd.png

The other option would be to create a type: count measure and just select your column as a dimension and the type count measure. This way we get a count grouped by the values in the dimension column. 

1ff57cea-a432-4ff3-9fdd-fe331c66420c.png

We can also do this in the explore, if we create a custom measure type count distinct on a primary key and then select the column you would like to group the count by. 
 

b0201149-ae59-4aad-8411-f552171fc335.png

Please let us know if you have any questions!

Thanks,

Eric

Top Labels in this Space
Top Solution Authors