Counting the occurrence of a certain character in string

Hello there,

I was wondering if there is a way to count the occurrence of a certain character in a string.

 

Specifically, I have a column that contains the gender information (M or F) of each data entry. 

All of the data entries are grouped according to a unique key, and while grouping, the gender column is collapsed with a comma between each entry belonging to that group.

Now I need to count the number of M's and F's for each group.

 

Could you please advise if this can be done.

Thank you in advance. 

 

Best,

Roxie

Comments

  • yes.

    calculate the length of your string.

    then subtract the length of your string if you replace the search character with a blank.

    ex. length('mf_string') - length(replace( 'mf_string', 'M', ''))

     

    Jae Wilson
    Check out my 🎥 Domo Training YouTube Channel 👨‍💻

    **Say "Thanks" by clicking the ❤️ in the post that helped you.
    **Please mark the post that solves your problem by clicking on "Accept as Solution"