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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

DAX to filter tables by regular expression

Hello,

 

I have following DAX code where I simply filter table gl by another table 'Sheet1' and sum values from gl:

Actuals = CALCULATE(SUM('public gl'[movement]),FILTER(ALL('public gl'[gl_code],'public gl'[business_unit]), 'public gl'[gl_code]='Sheet1'[gl_code] && 'public gl'[business_unit]='Sheet1'[business_unit]))
 
So Sheet1[gl_code] contains values like 1*, 2* and 101,102,201 etc. What I need is Filter to consider symbol * as regular expression and filter all gl_codes starts with 1 and 2 and also full gl_code`s like 101,102,201.
 
* symbol could be subsituted with other symbol. 
 
 
Regards,
Turkel.
 
4 REPLIES 4
VahidDM
Super User
Super User

Hi @Anonymous 

 

Try to use Left dax code in a filter, something like this:

filter(Sheet1,left(Sheet1[gl_code],1)=1&&left(Sheet1[gl_code],1)=2)

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.

Appreciate your Kudos🙏!!

Anonymous
Not applicable

Actually left DAX will not help here becouse gl_code could be 1*, 15* or full account 155 so in case of * it need to get all subaccounts.

 

Hi @Anonymous 

 

Can you share a sample of your data here? [In a Table Format]

 

Appreciate your Kudos!!

Anonymous
Not applicable

If you really want to have something like a regex matcher in DAX... well, you can forget it. There's no such thing in DAX. DAX has a very simple string pattern matching mechanism that is not even on par with the SQL LIKE operator, so any even unsophisticated pattern matching is not possible.

Helpful resources

Announcements
November Fabric Update Carousel

Fabric Monthly Update - November 2025

Check out the November 2025 Fabric update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Users online (25)