Forum Discussion

masplin's avatar
masplin
Impactful Individual
6 years ago
Solved

Service errors messages not seen when refreshing PBIX

I have created a date parameter and want to pass it into the SQL query part of my query. This seems to work absolutely fine refreshing the PBIX, but when I publish getting all sorts of horrible error messages such as below. all metion references to other queries.

 

Below is an example of the code I'm using to pull in the parameter "Loaddate"

 

let
    Source = Sql.Database("ACFT-VMDB-P33.apiia.ukfast", "master", [Query="
 SELECT 'Amex' AS [Client],
[FailedContactID] AS ParkedCallID,
ActionedByAdviserID AS AdviserID,
ActionedDateTime AS CallReturnedDT
FROM  [Amey_DW_REPORTING].[dbo].[Fact_Cases_FailedContacts]
WHERE ContactType = 1 AND ActionedDateTime IS NOT NULL
AND ActionedDateTime >='" & DateTime.ToText(Loaddate,"yyyyMMdd HH:mm") & "'

    "]),
    #"Appended Query" = Table.Combine({Source, #"ParkedCalls Returned P22"}),
    #"Extracted Date" = Table.TransformColumns(#"Appended Query",{{"CallReturnedDT", DateTime.Date, type date}})
in
    #"Extracted Date"

 

 

Is there some reason why the service can't understand this query whereas PBIX can?  Is there some other syntax that will allow me to use a power query parameter within the SQL query without it blowing up?

 

I appreciate I could add the parameter in a power Query filter AFTER the SQL SELECT, but this seems super inefficient as will oad the whole table and then throw a load of it away. 

 

Appreicate any advice

 

Mike

6 Replies