Split string with delimiter and count substrings in field

Hello,
I need some help with a measure in easybi. What I’m trying to do is split a field string with a delimiter and then count how many occurrences I will have.
Example:
Field returned - “Ticket 1, Ticket 2, Ticket 3”
Outcome needed - 3

Basically, do the count of how many tickets are in 1 field.
Is this possible to do? Maybe with MDX?

Appreciate any help on this.

Thank you
John

Hi, @loretij

You can create a new calculated measure using the Len function that returns the number of characters in a specified string:

Len(string) - Len(Replace(string, ',', ''))

This example counts how many values are in the Issues labels.

CASE WHEN NOT IsEmpty([Measures].[Issue labels]) THEN
Len([Measures].[Issue labels])
- Len(Replace([Measures].[Issue labels], ',', ''))
+ 1
END

I hope this is what you are looking for.

Kind regards,
Ilze