Metric queries from Loki aggregated by each key in a list

Hi all,
We have logs in Loki which contain a list of fields in every line. Is there any way to get statistics aggregated by each field in the list in a specified time range?
For example, we have 3 lines of logs:
{fields:[a, b, c]}
{fields:[a, c]}
{fields:[a]}
I want to get metrics showed in grafana like:
a: 3
b: 1
c: 2

Hope you could help me with it, thanks a lot!