5

In the Microsoft SSAS, I have a dimension column that contains multiple values separated by the special character | in a single row as below.

Example value of a row: Image|Video|Audio|

Requirement: So, I need to count the number of values present in the dimension column using the special character.

In this case, I need to get the count of | using the MDX query and my expected answer is 3.

Could someone help me with this? In short, Is there an MDX function that counts the number of times a particular character appears in a string?

Similar question for SQL: Number of times a particular character appears in a string

Sathish G
  • 91
  • 3
  • 1
    Do it in sql and include it in the cube for exploration. – mxix Dec 06 '22 at 12:44
  • I agree with @mxix that this is easier to do when you load the table. If you had to do in MDX, try a recursive measure with Instr(). See link for recursive example: http://mdxdax.blogspot.com/2011/04/performance-considerations-for.html – TheRizza Dec 21 '22 at 15:01

0 Answers0