cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AJTindall73 Frequent Visitor
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

SvenTexas Frequent Visitor
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.

Juramirez Member
Member

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

rohitpaliwal Frequent Visitor
Frequent Visitor

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

azizimranz Frequent Visitor
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?

mskhurram Frequent Visitor
Frequent Visitor

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 & "'

mskhurram Frequent Visitor
Frequent Visitor

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 & "'

sesin Frequent Visitor
Frequent Visitor

Re: parameters to SP or Sql query

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

sesin Frequent Visitor
Frequent Visitor

Re: parameters to SP or Sql query

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

sbahugu2 Regular Visitor
Regular Visitor

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
Back to School Contest

Back to School Contest

Engage and empower students with Power BI!

MBAS Gallery

Watch Sessions On Demand!

Continue your learning in our online communities.

Summit Australia 2019

Summit Australia 2019

Travel to Melbourne and network with thousands of peers!

Top Ideas
Top Kudoed Authors
Users Online
Currently online: 270 members 2,842 guests
Please welcome our newest community members: