How to get the count of rows in top hits

  • What Grafana version and what operating system are you using?
    Grafana Version 6 hosted on an internal devx server

  • What are you trying to achieve?
    FieldA | FieldB | Status | Time

  1. A1 | B2 | Pass | 10.00
  2. A1 | B2 | Fail. | 10.03
  3. A2 | B3 | Pass. | 10.04
    What i want is: Count of FieldA that have passed and failed.
    Passed: 1 (Entry 3 @10.04)
    Failed : 1 ( Entry 2 @10.03 because that is the latest status for FieldA A1)
  1. A1 | B2 | Fail. | 10.03
  2. A2 | B3 | Pass. | 10.04

The resultant table has the contents intended. But i need the count of Pass and Fail from this table.

  • What happened?
    When i change the visualization to anything other than table(like Single stats, stats, piechart) and try to get the count , it fails.
    I have also tried Derivative, and bucket script as below:

  • What did you expect to happen?
    To get the count of Passed and Failed from the output table of Top hits.

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
    No errors, just the count is not displayed.

I have also tried Derivative, and bucket script as below: