Show the frequency of occurrence with string value

Hi all,
I’m trying to show in a graph (possibly a bar chart or pie chart) the frequency that a field can take in a given time, but I just can’t figure out how to do it with the flux language.
I have a field that can take the value of 5 different strings.
So the calculation I think I have to do is:

NumberOfMetricWithStringValue1InAPeriod/TotalMetricInThatPeriod = Result1Percent
NumberOfMetricWithStringValue2InAPeriod/TotalMetricInThatPeriod = Result2Percent
NumberOfMetricWithStringValue3InAPeriod/TotalMetricInThatPeriod = Result3Percent
NumberOfMetricWithStringValue4InAPeriod/TotalMetricInThatPeriod = Result4Percent
NumberOfMetricWithStringValue5InAPeriod/TotalMetricInThatPeriod = Result5Percent

If there is no way to do this with strings it is also possible to insert a numeric value that represents the string.

Thanks in advance for your help :smile: