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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
hosea_chumba
Helper I
Helper I

DAX Formula

From my customers table, I would like to check the Phone No. column and return output where any of the below is true:

  1. Blanks
  2. Phone No. digits are not 9
  3. Phone No. with special characters

However, my formula below is not working, kindly assist with a better approach.

 

Invalid Phone No. Numbers =

VAR InvalidCharacters = “abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()”_+={}[]|\:;\'<>,.?/~`

RETURN FILTER('Customers',

   OR(

       ISBLANK('Customers'[Phone No.]),

       LEN('Customers'[Phone No.]) <> 9,

       NOT(ISNUMBER(VALUE('Customers'[Phone No.]))),

       COUNTROWS(FILTER(UNICHAR(SEQUENCE(LEN('Customers'[Phone No.]),1,0)), FIND(UNICHAR(SEQUENCE(LEN(InvalidCharacters),1,1)), UNICHAR(SEQUENCE(LEN('Customers'[Phone No.]),1,0)))) > 0),

       COUNTROWS(FILTER(UNICHAR(SEQUENCE(LEN('Customers'[Phone No.]),1,0)), FIND(" ", UNICHAR(SEQUENCE(LEN('Customers'[Phone No.]),1,0)))) > 0),

       COUNTROWS(FILTER(InvalidLengths, LEN('Customers'[Phone No.]) = VALUE)) > 0

   )

)

1 ACCEPTED SOLUTION
v-binbinyu-msft
Community Support
Community Support

Hi @hosea_chumba ,

Please try to create a calculate column with below dax formula:

Column =
VAR _a = [Phone No.digits]
VAR _b =
    IFERROR ( INT ( _a ), _a )
RETURN
    SWITCH (
        TRUE (),
        ISBLANK ( _a ), _a,
        IFERROR ( INT ( _a ), FALSE () ), _a,
        LEN ( _a ) <> 9, _a
    )

vbinbinyumsft_0-1699857277347.png

Please refer the attached .pbix file.

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-binbinyu-msft
Community Support
Community Support

Hi @hosea_chumba ,

Please try to create a calculate column with below dax formula:

Column =
VAR _a = [Phone No.digits]
VAR _b =
    IFERROR ( INT ( _a ), _a )
RETURN
    SWITCH (
        TRUE (),
        ISBLANK ( _a ), _a,
        IFERROR ( INT ( _a ), FALSE () ), _a,
        LEN ( _a ) <> 9, _a
    )

vbinbinyumsft_0-1699857277347.png

Please refer the attached .pbix file.

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Rupak_bi
Resolver II
Resolver II

Make a calculated column with those three classifications and then count them. It will be simple.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors