I changed my sql request
according which widget value is selected
.
I correct this request according my question enter link description here
This following my request:
SELECT "LRU", "Client", extract(month from "Facturation") as mt
CASE {{w_widget6.selectedValue}}
WHEN {{w_widget6.selectedValue}}=1 THEN
(select avg("Montant_fac_eur") as c1 from "foundry_sync"."data" where "month" between 1 and 6)
when {{w_widget6.selectedValue}} =2 THEN
(select avg("Montant_fac_eur") as c2 from "foundry_sync"."data" where "month" between 2 and 7)
when {{w_widget6.selectedValue}} =3 THEN
(select avg("Montant_fac_eur") as c3 from "foundry_sync"."data" where "month" between 3 and 8)
when {{w_widget6.selectedValue}} = 4 THEN
(select avg("Montant_fac_eur") as c4 from "foundry_sync"."data" where "month" between 4 and 9)
when {{w_widget6.selectedValue}} =5 THEN
(select avg("Montant_fac_eur") as c5 from "foundry_sync"."data" where "month" between 5 and 10)
when {{w_widget6.selectedValue}} =6 THEN
(select avg("Montant_fac_eur") as c6 from "foundry_sync"."data" where "month" between 6 and 11)
when {{w_widget6.selectedValue}} =7 THEN
(select avg("Montant_fac_eur") as c7 from "foundry_sync"."data" where "month" between 7 and 12)
END;
from "foundry_sync"."data"
group by "LRU", "Client"
But always I have the same error:
ERROR: syntax error at or near "CASE"
Position: 68
I'm using foundry-postgate
like source of my data into Palantir Cloud.
Can you tell me where's my fault ?