Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
canmarroig
Partner - Creator
Partner - Creator

Script sintax

Good morning, i've to build a SQL SELECT in order to merge two datas coming from different sources:

- a field coming from a file .xls
- another field coming from a ODBC

This will add the calculation of the margin range in the load script in order to use it in reports.

I started with a:

LEFT JOIN
LOAD

//of xls data to ODBC

//Billing Key is the common key

SELECT

,CASE
WHEN ROUND((a.Sales-b.Costs)/a.Sales,2) < -1 THEN 'less than -100%'
WHEN ROUND((a.Sales-b.Costs)/a.Sales,2) BETWEEN -.99 AND -.5 THEN 'FROM -100% and -50%'
.....

ELSE 'ND'
END AS [range]
FROM (SELECT Billing Key,SUM(Costs) AS (Costs) FROM Days GROUP BY Billing Key) b
ON a.Billing Key=b.Billing Key;

But i don't understand what's going wrong, perhaps this sintax isn't correct? Thank you for help

0 Replies