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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
jburbano
Frequent Visitor

I have a table that I want to filter by more than one startsWith in the Visual

I have a table with an definitionName columns that has some prefixes:

 

APIC-

ADF-

FA-

 

The built in filtering only allows for two and I need this to grow as it scales.  

 

I already have a list coming from the model, with the list of prefixes that I need to filter the table by at that specific column based on their individual values.  Not sure how to go on further from here.

 

I know I need a measure, but not sure how.

3 ACCEPTED SOLUTIONS
dharmendars007
Super User
Super User

Hello @jburbano , 

You can create a DAX measure to check if any of the prefixes from the PrefixTable exist at the beginning of the values in the definitionName column.

 

IsFilteredRow =
IF (ISBLANK (
SELECTCOLUMNS (
FILTER (
PrefixTable,
LEFT ( 'YourTable'[definitionName], LEN ( PrefixTable[Prefix] ) ) = PrefixTable[Prefix]),
"Filtered", PrefixTable[Prefix])),
0, -- Not a filtered row
1 -- Filtered row)

Add this measure to a table visual or use it as a slicer filter to only show rows with matching prefixes


If you find this helpful , please mark it as solution which will be helpful for others and Your Kudos/Likes 👍 are much appreciated!

 

Thank You

Dharmendar S

LinkedIN 

 

 

View solution in original post

FarhanJeelani
Super User
Super User

Hi @jburbano,

You want to filter a table where the definitionName column starts with any of the prefixes in your list (like APIC-, ADF-, or FA-). Since the built-in filters only allow two conditions, we can handle this with a DAX measure. Here’s how:

  1. Get Your Prefixes
    Make sure you have a table in your model (let’s call it PrefixTable) with a column that lists all your prefixes. If you don’t have one, create it.

  2. Write a Measure
    Create a measure in your model to check if a row in definitionName starts with any prefix. Here’s the formula:

    FilterByPrefixes =
    IF (
        SUMX (
            PrefixTable,
            IF (
                LEFT(YourTable[definitionName], LEN(PrefixTable[Prefix])) = PrefixTable[Prefix],
                1,
                0
            )
        ) > 0,
        1,
        0
    )

    This measure loops through all the prefixes in PrefixTable and checks if the start of definitionName matches any of them. If it does, it returns 1; otherwise, 0.

  3. Add It to Your Visual Filter

    • Drag the measure (FilterByPrefixes) into the Filters on this visual area.
    • Set it to filter where the value is 1. Now your table will only show rows where definitionName starts with one of your prefixes.
  4. Why This Works
    It’s flexible because as you add or remove prefixes in the PrefixTable, your filter updates automatically.

Please mark this as solution if it helps you. Appreciate Kudos.

View solution in original post

v-yangliu-msft
Community Support
Community Support

Thanks for the reply from FarhanJeelani  and dharmendars007 , please allow me to provide another insight: 

Hi  @jburbano ,

 

Here are the steps you can follow:

1. Create measure.

Flag =
var _select=SELECTEDVALUE('Slicer_Table'[Select])
RETURN
IF(
FIND(
    _select,MAX('Table'[Group]),1,BLANK())=1,1,0)

2. Place [Flag]in Filters, set is=1, apply filter.

vyangliumsft_0-1733969967544.png

3. Result:

vyangliumsft_1-1733969967545.png

 

 

Best Regards,

Liu Yang

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

3 REPLIES 3
v-yangliu-msft
Community Support
Community Support

Thanks for the reply from FarhanJeelani  and dharmendars007 , please allow me to provide another insight: 

Hi  @jburbano ,

 

Here are the steps you can follow:

1. Create measure.

Flag =
var _select=SELECTEDVALUE('Slicer_Table'[Select])
RETURN
IF(
FIND(
    _select,MAX('Table'[Group]),1,BLANK())=1,1,0)

2. Place [Flag]in Filters, set is=1, apply filter.

vyangliumsft_0-1733969967544.png

3. Result:

vyangliumsft_1-1733969967545.png

 

 

Best Regards,

Liu Yang

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

FarhanJeelani
Super User
Super User

Hi @jburbano,

You want to filter a table where the definitionName column starts with any of the prefixes in your list (like APIC-, ADF-, or FA-). Since the built-in filters only allow two conditions, we can handle this with a DAX measure. Here’s how:

  1. Get Your Prefixes
    Make sure you have a table in your model (let’s call it PrefixTable) with a column that lists all your prefixes. If you don’t have one, create it.

  2. Write a Measure
    Create a measure in your model to check if a row in definitionName starts with any prefix. Here’s the formula:

    FilterByPrefixes =
    IF (
        SUMX (
            PrefixTable,
            IF (
                LEFT(YourTable[definitionName], LEN(PrefixTable[Prefix])) = PrefixTable[Prefix],
                1,
                0
            )
        ) > 0,
        1,
        0
    )

    This measure loops through all the prefixes in PrefixTable and checks if the start of definitionName matches any of them. If it does, it returns 1; otherwise, 0.

  3. Add It to Your Visual Filter

    • Drag the measure (FilterByPrefixes) into the Filters on this visual area.
    • Set it to filter where the value is 1. Now your table will only show rows where definitionName starts with one of your prefixes.
  4. Why This Works
    It’s flexible because as you add or remove prefixes in the PrefixTable, your filter updates automatically.

Please mark this as solution if it helps you. Appreciate Kudos.

dharmendars007
Super User
Super User

Hello @jburbano , 

You can create a DAX measure to check if any of the prefixes from the PrefixTable exist at the beginning of the values in the definitionName column.

 

IsFilteredRow =
IF (ISBLANK (
SELECTCOLUMNS (
FILTER (
PrefixTable,
LEFT ( 'YourTable'[definitionName], LEN ( PrefixTable[Prefix] ) ) = PrefixTable[Prefix]),
"Filtered", PrefixTable[Prefix])),
0, -- Not a filtered row
1 -- Filtered row)

Add this measure to a table visual or use it as a slicer filter to only show rows with matching prefixes


If you find this helpful , please mark it as solution which will be helpful for others and Your Kudos/Likes 👍 are much appreciated!

 

Thank You

Dharmendar S

LinkedIN 

 

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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