Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Help Needed with Containsstring formula

I've got a column containing Phone numbers and I need to identify the mobile phone numbers.
The Dutch Mobile phone numbers are identified when the number:

- Starts with +316
- Starts with 00316
- Starts with 06

I've got the following formula and this works fine:

Type Phonenumber =
SWITCH(TRUE(),
CONTAINSSTRING('Maia Data - Shell SSPF'[maia.Persoon.telefoon(1)],"+316"),"Mobiel",
CONTAINSSTRING('Maia Data - Shell SSPF'[maia.Persoon.telefoon(1)],"00316"),"Mobiel","Anders")

However if I want to add CONTAINSSTRING('Maia Data - Shell SSPF'[maia.Persoon.telefoon(1)],"06"),"Mobiel" to this formula, it will recognize any number containing 06 as a mobile phone, which is incorrect.

So how can I make sure that the formula works correctly?

With kind regards,

Lazzanova
  • Anonymous's avatar
    Anonymous
    4 years ago

    HI

    Perhaps for "06" you should use left('Maia Data - Shell SSPF'[maia.Persoon.telefoon(1)],2). There is a lot of 06 insude tl numbers

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    HI

    Perhaps for "06" you should use left('Maia Data - Shell SSPF'[maia.Persoon.telefoon(1)],2). There is a lot of 06 insude tl numbers

  • Anonymous's avatar
    Anonymous
    Not applicable

    HI Anonymous,

    I think CONTAINSSTRING function may not suitable for your scenario, I'd like to suggest you take a look at the following blog about string comparisons and it includes 'start with', 'end with', 'contains', and fuzzy matches based on Dax expressions:

    From SQL to DAX: String Comparison 

    Regards,

    Xiaoxin Sheng