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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
joshikakrishna
New Member

DAX equivalent of SQL filter not LIKE [0-9] [%a-z%]

Hi,

I nee apply below filter in dax query.

Please help to accomplish this requirement.

How to apply filter with not like [%A-Z%] in DAX (SSAS tabular) + powber BI

 

Thanks

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

HI @joshikakrishna,

 

You can use below calculate column formula to create a variable dictionary table to compare with current text column:

Contains Text = 
VAR dict =
    SELECTCOLUMNS (
        GENERATESERIES ( 97, 122, 1 ),
        "UPPER", UNICHAR ( [Value] ),
        "LOWER", LOWER ( UNICHAR ( [Value] ) )
    )
RETURN
    COUNTROWS (
        FILTER (
            dict,
            SEARCH ( [UPPER], [Text], 1, -1 ) > 0
                || SEARCH ( [LOWER], [Text], 1, -1 ) > 0
        )
    )
    > 0

 

18.PNG

 

In addition, you can also take a look at following blog which mentioned dax string comparison:

From SQL to DAX: String Comparison

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

2 REPLIES 2
kazael
Helper I
Helper I

@joshikakrishna

I would recommend using the search function (https://dax.guide/search/). 

You can post an example of your data and I'll try to help 

v-shex-msft
Community Support
Community Support

HI @joshikakrishna,

 

You can use below calculate column formula to create a variable dictionary table to compare with current text column:

Contains Text = 
VAR dict =
    SELECTCOLUMNS (
        GENERATESERIES ( 97, 122, 1 ),
        "UPPER", UNICHAR ( [Value] ),
        "LOWER", LOWER ( UNICHAR ( [Value] ) )
    )
RETURN
    COUNTROWS (
        FILTER (
            dict,
            SEARCH ( [UPPER], [Text], 1, -1 ) > 0
                || SEARCH ( [LOWER], [Text], 1, -1 ) > 0
        )
    )
    > 0

 

18.PNG

 

In addition, you can also take a look at following blog which mentioned dax string comparison:

From SQL to DAX: String Comparison

 

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.