Flux query to count occurrences of tags

C How to count the number of occurrences of a tag (OS is a tag my series) in influxdB?
My result should be tag_name, count

OS Count
Windows 3
Linux 4

I need to finally draw a pi in grafana with the query…The pie should depict the no of users per OS.

yes, that should work, something like this:

from(bucket: "my-bucket")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> group(columns: ["OS"], mode:"by")
  |> count()