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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
ChainSpart
Frequent Visitor

Text.Contains with underscore

Hi there,

 

I'm working with the Power Query editor right now.

I have a table connected to my database, and I need to apply a parameter in my request to get some values, else I get an error of query (this is ok).

 

So I've created a text type parameter which help me to get values in my table.

but when this parameter contains an underscore, the request fails, as if the underscore split my parameter.

 

Is there any way to include the underscore in the parameter to have my good results please ?

 

Here is 2 examples : 

- WORKS :  Table.SelectRows(dbo_AnalogHistory, each Text.Contains([TagName], "AAA.BBB.CC"))

- FAILS :  Table.SelectRows(dbo_AnalogHistory, each Text.Contains([TagName], AAA_BBB_CC))

 

Thanks.

1 ACCEPTED SOLUTION

Hi @Anonymous and thanks for answering ! 

Fortunately, I found an other way to get my data, using a direct Query with the parameter in the WHERE clause like this :

 

Source = Sql.Database("xxx", "yyy", [Query = "SELECT * FROM [Runtime].[dbo].[History] WHERE [Name] like '%"&ParamName&"%'"])

 

 

Thanks for trying to help 🙂

 

Now my other problem which I can't find a solution is this one :

https://community.powerbi.com/t5/Desktop/Parameter-Binding-Error-Parameter-is-not-defined-in-model/m-p/1933432#M736960

 

Here is the solution : 

 

 

 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @ChainSpart 

What kind of database are your trying to connect to? 

Can your parameter without any symbol like"A","B" or with other symbols like dot succeed to filter your table?

Will you get any message when you use the parameters with underscore?

If it is possible, you can show me the screenshot about your issue and show me your M code in Advance Editor.

 

Best Regards,

Rico Zhou

 

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

Hi @Anonymous and thanks for answering ! 

Fortunately, I found an other way to get my data, using a direct Query with the parameter in the WHERE clause like this :

 

Source = Sql.Database("xxx", "yyy", [Query = "SELECT * FROM [Runtime].[dbo].[History] WHERE [Name] like '%"&ParamName&"%'"])

 

 

Thanks for trying to help 🙂

 

Now my other problem which I can't find a solution is this one :

https://community.powerbi.com/t5/Desktop/Parameter-Binding-Error-Parameter-is-not-defined-in-model/m-p/1933432#M736960

 

Here is the solution : 

 

 

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.