Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
t_hylander
Creator
Creator

Problem with group by in loadscript

Hi,

I've been staring at this for a while now but can't see the problem, but Qlikview is kindly whining about "Error in expression:

')' expected" somewhere.

I'd like extract data from a qvd and sum it up grouped by year and month. I tried to make it easier for me just using 2018, therefore only using month in the group by.

The script looks like this;

Load
'2018' as KPI_år,
month(date(Transtid)) as KPI_månad,
'1' as _KPI_Intransp,
sum(Nettovikt) as TotalTon_Månad
from [..\1_Extract\Vågen\TRANS.qvd] (qvd)
where (
Status=2 and
Leverantor = '90101' and
Artikel >= '1000' or Artikel <= '2999' and
year(date(Transtid)) = '2018'
Group by month(date(Transtid))
);

21 Replies
t_hylander
Creator
Creator
Author

This app is for CEOs and they dont care about granular data, so thats why I dont want to load a lot unneccasary data.

See if this helps a Little bit more;

To use a diffrent angle of example;

I want to show the sum of the ordervalue on all orders per month, but I want to do the aggregation at load instead.

t_hylander
Creator
Creator
Author

I made a workaround;

load
KPI_år,
KPI_månad,
sum(KPI_Nettovikt) as KPI_TotalTon
where _KPI_Intransp = '1'
group by KPI_år, KPI_månad;


Load
'2018' 
as KPI_år,
month(date(Transtid)) as KPI_månad,
Nettovikt as KPI_Nettovikt,
if(Artikel>='1000',
if(Artikel<='2999', '1','0')) as _KPI_Intransp
from [..\1_Extract\Vågen\TRANS.qvd] (qvd)
WHERE(
Status = '2' and
Kund = '90101' and
year(date(Transtid)) = '2018')
;