Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
prrajendran
Contributor III
Contributor III

Aggregation in script

Hi,

I have the following tables loaded in the script

Vehicle:

LOAD VehicleKEY,
     VehicleCode,
     [Vehicle Primary Type],

 [Vehicle Secondary Type]
    
FROM Vehicle.qvd

Activity:

LOAD Activity,     
     [Activity Key]

FROM Activity.qvd

Employee:

Load EmployeeKEY,

     [Employee Type]

From Employee.qvd

Time:

Load TimeKEY,

     Hour,

     [15 min Interval]

From Time.qvd

[Fact Data]:
LOAD Date,
     EmployeeKEY,
     VehicleKEY,
     TimeKEY,
     Area,

     Group
    [Time in Seconds],
     [Activity Key]
   
FROM Data.qvd

From this data, I am reporting Two Metrics with the expressions below:

Average Vehicle Count:

AVG(AGGR(

(count({<[Vehicle Primary Type]={'SUV'},Activity ={'Logged'},[Vehicle Secondary Type]={'Manual','Auto'},[Employee Type]-={'Not Available'}>}VehicleCode)
+
count({<[Vehicle Primary Type]={'Hatch'},Activity ={'Logged'},[Vehicle Secondary Type]={'Manual','Auto'},>}VehicleCode))

,[15 min Interval],Date))

 

Logged Time/day:

Interval(

(sum({< Activity = {Logged},Group={S},[Employee Type]-={'Not Available'}>}
[Time in Seconds]/86400)
/
count(Date))

,'hh:mm:ss')

I want to replicate this in the script itself. Is it possible? Because the data is too big and it is taking long time to load the chart. Can someone please help me with the script?

Labels (1)
2 Replies
Brett_Bleess
Former Employee
Former Employee

I would recommend checking out the posts in the Design Blog area, this is likely going to be your best bet outside a consulting engagement to have someone help you with things.  The fact nobody else has responded would lead me to believe folks wanted to have some actual sample data to play with etc., but then again, this one may be fairly complex to sort out in the script too with limited use case info.

https://community.qlik.com/t5/Qlik-Design-Blog/bg-p/qlik-design-blog

There are over 700 posts in the above area, so this may provide you with some ideas on how to go about things, but it may take some searching to find the ones that will actually give you the right ideas.  Sorry I do not have something better for you.

Oh, you could also have a look at Rob W's Cookbook pages, he may have some further examples of things too:

https://qlikviewcookbook.com/

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.
Brett_Bleess
Former Employee
Former Employee

See duplicate post: https://community.qlik.com/t5/New-to-QlikView/Aggregation/m-p/1672806/highlight/false#M386257

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.