Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Count distinct with different formats

Hi Everyone,

I want to count the unique customer that have more than 1 # Offered using expression. but some of the CSD. Formatted Number has different format.

(ie. tel:+61399389998;phone-context=national , tel:+6139938999😎 this should only be counted as 1 customer.

Data:  

CSD.Customer Formatted Number# Offered
tel:+61399389998;phone-context=national39
tel:+61399389998;phone-context=national23
tel:+61399389998;phone-context=national2
tel:+61399389998;phone-context=national1
tel:+61399389998;phone-context=national0
tel:+613993899985
tel:+613993899984
tel:+613993899981
sip:0anonymous@anonymous.invalid654
sip:0anonymous@anonymous.invalid216
sip:0anonymous@anonymous.invalid77
sip:0anonymous@anonymous.invalid29
christopher.w@yahoo.com5

Expected Result:

Repeat Callers
tel:+613993899981
sip:0anonymous@anonymous.invalid1
christopher.w@yahoo.com1
1 Solution

Accepted Solutions
sunny_talwar

petter-s

You might have left a closing parenthesis for the measure.

Also eustisab‌, if possible perform this transformation in the script like this

LOAD [CSD.Customer Formatted Number],

     SubField([CSD.Customer Formatted Number], ';', 1) as RequiredString,

     [# Offered]

FROM ...;

Once this is done, you can just use this

Dimension

RequiredString

Expression

Count(DISTINCT RequiredString)

View solution in original post

2 Replies
petter
Partner - Champion III
Partner - Champion III

You can define the dimension in the table as:

SubField(CSD,';',1)

And the measure as:

Count(DISTINCT SubField(CSD,';',1)

sunny_talwar

petter-s

You might have left a closing parenthesis for the measure.

Also eustisab‌, if possible perform this transformation in the script like this

LOAD [CSD.Customer Formatted Number],

     SubField([CSD.Customer Formatted Number], ';', 1) as RequiredString,

     [# Offered]

FROM ...;

Once this is done, you can just use this

Dimension

RequiredString

Expression

Count(DISTINCT RequiredString)