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

Re: parameters to SP or Sql query

Hi Sven, just dont add the "Text.ToText" part. it's already text.

 

for example:

 

let
    SQLSource = (param1 as text, param2 as date) =>
let  
    Source = Sql.Database("MyServer", "MyDatabase", [Query="exec [MyDatabase].[dbo].[myProc] '"& param1 & "','" & Date.ToText(param2)&"'"])
in
    Source
in
    SQLSource

 I hope this helps.

 

Alan

Highlighted
Frequent Visitor

Re: parameters to SP or Sql query

Thank you Alan - can't believe I missed the obvious!  Thank you for putting the response on, am sure it will help others out too.

Highlighted
Resolver I
Resolver I

Re: parameters to SP or Sql query

Hi @v-yuezhe-msft,

 

I'm dealing with something like this but this doesn't work for me. I want, in the step 3, fill these values with the value from an app. It's is possible? Full post is available here.

Thanks in advance

Julian

Highlighted
New Member

Re: parameters to SP or Sql query

Guys do we've a solution for this, I've similar requirement, I've got four drop downs in my report

 

1. Country

2. State

3. City

4 Store

 

the navigation is working fine, but I've a requirement to take this to next level i.e. in each drop down I've option to select either one or all, now once the selection is made, I want to use this as a input parameter for a stored procedure which resides in my sql server database.

I understand that in the new query editor I can use the stored procedure but how do I populate the parameter from the drop down visualization i.e. slicer in my case (I can use some other visualization aslo), first will list country, second will have states, third will have city and fourth will have storeIDs, now I can either have all selected or any indivudial values and on the basisi of this select tion, my procedure should execute like below

 

exec dbo.myproc countryid = @countryvar,  stateid = @statevar, cityID = @cityID, storeDi = @storeID

Highlighted
Frequent Visitor

Re: parameters to SP or Sql query

@SvenTexas

 

let
SQLSource = (Start_Date as date, End_Date as date, Fund_Name as text) =>

 

 

Not sure... is this what you were looking?

Highlighted
Anonymous
Not applicable

Re: parameters to SP or Sql query

 

Guys, you dont need to use Text.ToText, It is required for only non text values. 

for example: '"& VariableName & "'

Highlighted
Anonymous
Not applicable

Re: parameters to SP or Sql query

 

Guys, you dont need to use Text.ToText, It is required for only non text values. 

for example: '"& VariableName & "'

Highlighted
New Member

Re: parameters to SP or Sql query

I use like  '"&Text.From(Period)& "'

Highlighted
New Member

Re: parameters to SP or Sql query

I use like  '"&Text.From(Period)& "'

Highlighted
Helper I
Helper I

Re: parameters to SP or Sql query

Seems this is a solution for PBI desktop only.

Dont know what will be the benifit of this if we have to modify parameter every time a new range of data is required and then publish the report. 

 

I was looking for similar implementation in service side but no success so far.

Helpful resources

Announcements
Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Mark your calendars and join us for our next Power BI Dev Camp!.

Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors