Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hi all,I have made a date parameter for a t-sql stored procedure and tried to insert the name of the parameter on the code, but it doesn't work, see below code from advanced editor and also the error message, appreciate if someone can tell me what i am doing wrong.
let
Source = Sql.Database("sap", "entie", [Query="execute [1test] "&Date]),
#"Extracted Date" = Table.TransformColumns(Source,{{"Date", DateTime.Date, type date}}),
#"Pivoted Column" = Table.Pivot(Table.TransformColumnTypes(#"Extracted Date", {{"Date", type text}}, "en-GB"), List.Distinct(Table.TransformColumnTypes(#"Extracted Date", {{"Date", type text}}, "en-GB")[Date]), "Date", "Balance", List.Sum)
in
#"Pivoted Column"
ERROR MESSAGE:
Expression.Error: We cannot apply operator & to types Text and Date.
Details:
Operator=&
Left=execute [1test]
Right=01/01/2020
Best Regards,
Daniel
Solved! Go to Solution.
Hi @danielcarreira1 ,
Please update the applied codes in your Advanced Editor as below, the part with red font is updated one. Please note that the Date with blue font is date parameter name....
| let Source = Sql.Database("sap", "entie", [Query="exec [1test] '"& Date.ToText(Date) & "' #(lf)#(lf)#(lf) #(lf) "]) , #"Extracted Date" = Table.TransformColumns(Source,{{"Date", DateTime.Date, type date}}), #"Pivoted Column" = Table.Pivot(Table.TransformColumnTypes(#"Extracted Date", {{"Date", type text}}, "en-GB"), List.Distinct(Table.TransformColumnTypes(#"Extracted Date", {{"Date", type text}}, "en-GB")[Date]), "Date", "Balance", List.Sum) in #"Pivoted Column" |
In addition, you can also refer the following links to update the codes...
Execute SQL Server Stored Procedure With User Parameter In Power BI
Best Regards
Hi @danielcarreira1 ,
Please update the applied codes in your Advanced Editor as below, the part with red font is updated one. Please note that the Date with blue font is date parameter name....
| let Source = Sql.Database("sap", "entie", [Query="exec [1test] '"& Date.ToText(Date) & "' #(lf)#(lf)#(lf) #(lf) "]) , #"Extracted Date" = Table.TransformColumns(Source,{{"Date", DateTime.Date, type date}}), #"Pivoted Column" = Table.Pivot(Table.TransformColumnTypes(#"Extracted Date", {{"Date", type text}}, "en-GB"), List.Distinct(Table.TransformColumnTypes(#"Extracted Date", {{"Date", type text}}, "en-GB")[Date]), "Date", "Balance", List.Sum) in #"Pivoted Column" |
In addition, you can also refer the following links to update the codes...
Execute SQL Server Stored Procedure With User Parameter In Power BI
Best Regards
[Query="execute [1test] " & Text.From(Date)]
But you likely still won't be able to run that. What date format is the SP expecting?
Hi Ibendlin,
It didn't worked, the SP is expecting a date format
Best Regards,
Daniel
which exact data format ? yyyy-MM-dd ?
Hi Ibendlin,
The date format is dd/mm/yyyy
Best Regards,
Daniel
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 3 | |
| 3 | |
| 2 |