Unique count per fieldA by FieldB and sum this total per fieldC + graphing

I want to do a unique count per fieldA(serialNumber) by FieldB(CommandID) and sum this total per fieldC(farmID).
Which I can do in Kibana, but then I want to be able to collapse the rows to just show the FieldC(farmID) value.

the below picture might illustrate it better.

I have got the value in kibana(using visualisations) as the pic shows.
Any idea how to collapse the rows?
Or How would I be able to plt this value 92, over time at a per farm level in kibana or grafana

kibana pic

grafana pic

posted here also as is a kibana/grafana related topic.

  • What Grafana version and what operating system are you using?
    7.5.7

  • What are you trying to achieve?
    as above, grouping by, unique count by multiple fields

  • How are you trying to achieve it?
    using kibana search and grafana transforms

  • What happened?
    n/a

  • What did you expect to happen?
    n/a

  • Can you copy/paste the configuration(s) that you are having problems with?
    n/a

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
    n/a

  • Did you follow any online instructions? If so, what is the URL?
    no