Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

day sum from hour data

Hi,

im loading large amounts of data from a database, and the data is too much detailed for the current task.
the data was created every hour, but only the sums of each day and month are needed.

The same group by has worked before on other projects and the editor shows no error, but when reloading the script, i just get a script error for the day_sums table.

Any ideas what could be the problem here ? The qv compiler is not helpfull (as always)

the testdata.xlsx is attached

Dummy_byhours:

LOAD source,

     mon,

     day,

     hour,

     parameter,

     unit,

//     sum(Daten),

     DATA as DATA_h

FROM

.\test_data.xlsx

(ooxml, embedded labels, table is Tabelle1);

day_sums:

noconcatenate LOAD

     source,

     day,

     sum(DATA_h) as DATA_d_sum, // script error here

     unit

RESIDENT Dummy_byhours

GROUP by day, source

;

1 Solution

Accepted Solutions
rubenmarin

Hi Andreas, you need to add 'unit' to the group by clause, or remove it from the LOAD.

View solution in original post

5 Replies
Not applicable
Author

GROUP by source;

Should be:

GROUP by day, source, unit;

rubenmarin

Hi Andreas, you need to add 'unit' to the group by clause, or remove it from the LOAD.

MK_QSL
MVP
MVP

add unit also in group by

hic
Former Employee
Former Employee

Data: 

LOAD source,  

     mon,  

     day,  

     parameter,  

     unit,  

     sum(DATA) as Data

FROM  [.\test_data.xlsx] (ooxml, embedded labels, table is Tabelle1)

  GROUP BY source, mon, day, parameter, unit; 

HIC

Vidit
Creator
Creator


Dummy_byhours:

LOAD source,
mon,
day,
hour,
parameter,
unit,
DATA as DATA_h
FROM

(
ooxml, embedded labels, table is test);



day_sums:
noconcatenate
LOAD
source,
day,
sum(DATA_h) as DATA_d_sum, // script error here
unit

RESIDENT Dummy_byhours
GROUP by day, source ,unit
;

//drop if not required
drop table Dummy_byhours;