cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Olivierln
Frequent Visitor

Parameterd On NativeQuery with bigquery

Dear community,

 

I do have difficulties to use a parameter to feed a where clause in powersuety using the native query with BiqQuery.

I am used to do it with Oracle, but it looks like it does not work with biquery.

Any tils? 

6 REPLIES 6
ppm1
Solution Sage
Solution Sage

You should be able to concatenate your parameter into the text string with your native query in the Advanced Editor. Have you tried that?

 

Pat

Microsoft Employee

I do not get your answer. 

Let s say my parameter is name : country

My native query is 

Source = Value.NativeQuery(GoogleBigQuery.Database()
{[Name="abc-stock"]}[Data],
"select * from abc-stock.uk.uk
where location = - >here i want my country<-)",
null,
[EnableFolding=true])

In Source

 

How do you pass you parameter as string in the clause where

Assuming country is a text parameter (not a list or any), this should work.

Source = Value.NativeQuery(GoogleBigQuery.Database()
{[Name="abc-stock"]}[Data],
"select * from abc-stock.uk.uk
where location = " & company,
null,
[EnableFolding=true])

In Source

 

Pat

Microsoft Employee

Hi, 

Tkx, 

 

I have made my test, unfortunately it doesn't get the content of the parameter. very strange

 

DataSource.Error: ODBC: ERROR [42000] [Microsoft][BigQuery] (70) Invalid query: Unrecognized name: LOE at [53:23]
Details:
DataSourceKind=GoogleBigQuery
DataSourcePath=GoogleBigQuery
OdbcErrors=[Table]

Not sure if this will work but when trying to pass parameters back to SQL DB I have to use the following format:

where location = '"&country&"'

 

be careful whe typing it as PQ does weird things like '"&country""' automatically so double check in the formula bar rather than the advanced editor

So great ! working well with double '&'

where location = '"&country&"'

 

https://www.youtube.com/watch?v=E-WHW-QNswE

Helpful resources

Announcements
PBI Sept Update Carousel

Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

Learn Live

Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

MPPC 2023 PBI Carousel

Power Platform Conference-Power BI and Fabric Sessions

Join us Oct 1 - 6 in Las Vegas for the Microsoft Power Platform Conference.

Top Solution Authors
Top Kudoed Authors