KNOWLEDGE BASE

Counting Occurrences of a String Within a Dimension


Published: 20 Jan 2014
Last Modified Date: 12 Dec 2017

Question

How to count the number of times a particular text string occurs within a dimension.

Environment

Tableau Desktop

Answer

Option 1:

Use a calculation similar to the following to count how many times the substring occurs in any value of the dimension [String].

COUNT(CONTAINS([String],"substring") )

Option 2:

Use a calculation similar to the following to count occurrences of a string value within a dimension:

COUNT
(IF
CONTAINS([DIMENSION],'VALUE') == TRUE THEN [DIMENSION]
END)
 
Did this article resolve the issue?