Hi,
I seem to get nothing but pain with PQ, I've never managed to make it do anything remotely useful.
Could someone please put me out of my misery and tell me what's wrong with the below?
I get the following error:
Expression.Error: We cannot convert a value of type Record to type Text.
Details:
Value=Record
Type=Type
let
Source = Sql.Database("themis","zeus"),
Test = Value.NativeQuery("
SELECT actkeyactor,
actpayrollid,
acthrsystemid,
results.firstname,
results.surname,
results.dvpdescription,
dbadescription,
results.depot,
results.performance,
deductions,
netpayment
FROM (SELECT CASE
WHEN Substring(Ltrim(driver), 1, 2) IN ( 'A ', 'P ' ) THEN
Rtrim(
Substring(driver, 3, Patindex('% %', Substring(driver, 3, 100))
))
ELSE Substring(driver, 1, Patindex('% %', driver))
END
FirstName,
RIGHT(driver, Patindex('% %', Reverse(Rtrim(driver))) - 1)
Surname,
*
FROM zeusdatawarehouse.dbo.summarydrivercredits
WHERE reportingmonth = @startDate) results
LEFT JOIN tb_actactor
ON actfirstname = results.firstname
AND actsurname = results.surname
LEFT JOIN tb_dbadriverband
ON dbaidnumber = actdriverband
WHERE actkeyactor IS NOT NULL
AND actlocked = 'F'
AND results.totaltarget != 0
AND netpayment > 0
AND actemployeestatus IS NULL",
[startDate="2017-11-01"])
in
Test
Bookmarks