Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago

parameterized direct query in powerBI

Hi All,

 

I'm trying to run a direct query with a parameter, (parameter value is selected based on user selection in slicer and capturing it in the parameter) below is the Mquery, The query works fine in PowerBI Desktop but when published into pPowerBI service get an error (unable to connect to DB/timeout error/contact DB adminstration) , their are other direct queries in file without where clause (slect * from table) this query is able to connect to DB only Query with where clause or parameter value is not able to connect on publishing into PowerBI service, any help would be ge greatly appriciated. 

 

In below scenario I'm calling a function public.tna_get_po_milestone_date by parameter passing value (styleID) alomng with other hardcoded values.

 

let

//Create the query
dbQuery = "SELECT public.tna_get_po_milestone_date('" & styleID & "','ISD','31-dec-2022','FGA')",
//Get the data
Source = PostgreSQL.Database(<<Server Address>>, <<DB Name>>,[CommandTimeout=#duration(0, 1, 30, 0)]),

Test = Value.NativeQuery(Source,dbQuery, null, [EnableFolding=false])
in
Test

6 Replies