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
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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.