Forum Discussion

danielcarreira1's avatar
danielcarreira1
Regular Visitor
4 years ago
Solved

Help with code to pass parameter in report

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...
  • Anonymous's avatar
    Anonymous
    4 years ago

    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