Getting percent from one count divided by another

  • 20 April 2019
  • 3 replies

I need to display a percent on my dashboard. This percent should be calculated by dividing one count measure (derived from certain filters applied) over another count measure (which does not have those same filters).

For example, I select “count” and it gives me 40 when I apply the “in the month February” filter. Without this filter, the count would be 100. I need to display 40/100 = 40% on my final dashboard.

I tried using table calculations, but since both the column names are the same, I can’t divide them with each other. Any other way to do this?

3 replies

Userlevel 7
Badge +1

I don’t think this should be happening— I tried to do this with a filtered measure and a normal count and it worked fine. The custom filtered measure doesn’t have a view name reference in it, so it would just be ${count} while the count measure would be ${view_name.count} like ${count}/${ascent.count} in my instance.

Can you maybe send a screenshot, or more info about what your calculations look like?

For example, if my table stores a count of colors, and there’s 2 available colors: Blue and green. If I want to see a count of only the blue, I’d select “Color count” and filter it to show only blue. Suppose there are 30 colors total, but when I filter it, it shows 23 in the one row under “Color count” because the filter is counting only the blues.

Now I want to show this 23/30 as a percent. But, how do I write a table calculation for it if the column name is Color count in both cases-- only difference is one is a lower count because of a filter.

Thank you for the help!

Userlevel 7
Badge +1

I think despite being the same “Column name”, table calculations won’t allow there to be confusing references like that.

Here, I created two table calculations and called them both “one”— The editor automatically changes one to “one_2”

In your case, I think you’d want to first return your total count measure:

Then, return your filtered measure for blue (in my climbing example, bouldering):

Now I have count and count boulder, and to get the percent of total, I can say:

If you start typing the name of a field in the table calc builder, it’s usually pretty good at auto suggesting the reference you’re looking for.

If that walkthrough doesn’t help, I’d love to see screenshots of what you’ve got so I can better understand!