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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Filtering words using strartwith with DAX

Hello Everyone,

 

I have a column ('ColumnA') containing a string in the format "AAA-word1, AAA-word2, BBB-word3", with varying numbers of words in each entry. My goal is to create a new column ('ColumnB') derived from 'ColumnA' that isolates and returns only the words starting with "AAA", or even just contains "AAA".

 

Like:

"AAA-word1, AAA-word2, BBB-word3" -> "AAA-word1, AAA-word2"

 

I'm limited to performing this operation within Power BI (using DAX) as I don't have direct access to modify the source data.

Any insights, suggestions, or sample DAX code would be greatly appreciated!

Cheers

 

3 REPLIES 3
DOLEARY85
Resident Rockstar
Resident Rockstar

Hi,

 

you could try creating a calculated column to get everything before the first '-' then use that column in a slicer

 

Column = LEFT('Table'[Word], FIND("-", 'Table'[Word]) - 1)
 
If I answered your question, please mark my post as solution, Appreciate your Kudos 👍

Additionally, if due to the data source you're not able to use a calculated column it would also work as a measure:

 

Measure = LEFT(
    CALCULATE(
        MAX('Table'[Word]),
        FILTER('Table', FIND("-", 'Table'[Word]) > 0)
    ),
    FIND("-", CALCULATE(MAX('Table'[Word]), FILTER('Table', FIND("-", 'Table'[Word]) > 0)))-1
)
 
If I answered your question, please mark my post as solution, Appreciate your Kudos 👍
Adescrit
Impactful Individual
Impactful Individual

Hi @Anonymous,

You can use the CONTAINSSTRING function to achieve this.

https://learn.microsoft.com/en-us/dax/containsstring-function-dax

Your code can be something like this:

Column B = IF( CONTAINSSTRING([Column A], "AAA"), [Column A] )


Did I answer your question? Mark my post as a solution!
My LinkedIn

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

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.

Top Solution Authors