GROUP, MAP and COUNT

Need some help with getting data out the right way.

I have a data structure as follows:

{id
date
symptom ( = list of objects)
{id
tag}
}

In the data there can be multiple symptoms

What I want is a list of

tag 1 count
tag 2 count
etc.

Obviously a container with text items in repeat is needed. How can I put together a function that does right GROUP, MAP and COUNT?

Thanks in advance

This post is the answer to my question:

I am using the following adaption of the formula:

GROUP(SORT_BY_KEY(FLATTEN(MAP(data.SymptomdataColl, item.symptom)),“tag”), item.tag, {tag: key +" (“+ COUNT(items)+”)"})

1 Like

Here is how to make your schema look more understandable, type in like this:
image

So that you get this clear rendering:

{id, date, symptoms 
  [
   {id, tag}
  ]
}