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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
Anonymous
Not applicable

Passing a Filtered Table to SEARCH function

I have an InputTable table that has "~" in some rows in it's [Value] column. I want to remove / filter these rows and then pass the filtered InputTable table to a SEARCH function which will then do a partial match of the words in a single-column table WordList[Words] with the text in the InputTable[Value] column. Then find a Count of such matched values.

 

Right now SEARCH is doing a partial match on all the rows of the InputTable[Value] column which is increasing calculation time. I need to reduce time by excluding SEARCH from searching these ~ rows.

P.S: I want to do this using a DAX formula and not in Power Query.

 

VAR GT = COUNTA(InputTable[Value]) RETURN

IF(HASONEFILTER(WordList[Words]),

COUNTROWS( 
    CALCULATETABLE(
        InputTable
        , FILTER( InputTable, IFERROR(SEARCH(FIRSTNONBLANK(WordList[Words],1), InputTable[Value] ), -1)> 0 )
    )
)
,
GT
)


Thanks.

2 REPLIES 2
v-frfei-msft
Community Support
Community Support

Hi @Anonymous ,

 

Actually we can use KEEPFILTERS to work on it.

 

Measure 3 = var k = FILTER(InputTable,SEARCH("~~",InputTable[values],,BLANK())=BLANK())
return
CALCULATE(COUNTROWS(WordList),FILTER(WordList,WordList[Word] in VALUES(InputTable[values])),KEEPFILTERS(k))

Capture.PNG 

 

Regards,

Frank

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.
Anonymous
Not applicable

HI @v-frfei-msft ,

 

Getting an error for the "IN" operator for DAX in Excel 2016 PowerPivot. Here is the Sample Tool and Dummy Data files for your perusal.

 

IN operator error.JPG

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.