Show a total number of rows with a filter

I’m tryng to show a really simple total value but I can’'t figure out how to show this number as a KPI.

Here is my data, grouped by segment (the raw data have one line per date, but it should not be relevant here) :

"segment","Fit","eligible","selected","count segment"
"2:68",0.87,1243,1083,1
"2:16",0.79,720,574,1
"2:02",0.75,2532,1924,1
"2:67",0.82,2282,1877,1
"2:51",0.75,2176,1644,1
"2:78",0.75,2897,2198,1
"5:14",0.73,288,211,1
----------------------
      ,0.78,  ,     ,7
  • The “Fit” is a calculated field : sum(selected)/sum(eligible)
  • the “count segment” is also calculated and is here to show the total number of rows : distinct_count(segment)

So here the total shows 7 and I have 7 lines it works.

Now I want to filter only segments with a “Fit” above a certain value.
I managed to do that by applying a filter on the visual, and with “Fit” > 0.8 I got :

"segment","Fit","eligible","selected","count segment"
"2:68",0.87,1243,1083,1
"2:67",0.82,2282,1877,1
----------------------
      ,0.84,  ,     ,2

Here my total is “2” and this is the number I’m interested in: I want to show this number in a KPI visual !
But I don’t manage to show it.

  • I tried to apply the filter “Fit greater than 0.8” on the KPI
  • I also tried the calculated field : distinct_countIf(segment, (selected/eligible) > 0.8)

But in both case the total don’t match “2”.
How can I have a total in my KPI reflecting the number of rows after a filter ?

Thanks for you help

Hi! You should be able to apply a filter to the KPI and count those segments. I created a simple example using the raw data you provided. I created a KPI visual with Segment (Count) as my value. I then applied a filter to that KPI where fit > .8. I show 2 in the KPI count which reflects the filter applied. Attached is a screenshot of my solution.

Hope that helps!
Kellie

Hello Kelli,
Thanks a lot for your help and taking the time to answer, it helped me for my dashboard !

1 Like