Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
michak80
Contributor III
Contributor III

How to calculate a avarage qty

Hello everyone!

I have following columns: 

OH_CREATION_DATE in format DD/MM/YYYY hh:mm:ss.
OH_ORDER_ID what is Order number 
I made hours using 'hour (OH_CREATION_DATE)' and the result is as below in table. 
then I use count (distinct OH_ORDER_ID) to count qty of orders by each hour (see below).

I need also avarage qty of orders created by each our. I tried 

Avg(Aggr(count(distinct OH_ORDER_ID), hour(OH_CREATION_DATE))) 

but it does not work. 

Any ideas how I can show such information? Thank you in advance

michak80_0-1740688083730.png

and it's not big issue but maybe you know how recieve hour in format hh (I mean 00, 01 instead of 0, 1) 

 

Labels (3)
1 Solution

Accepted Solutions
Chanty4u
MVP
MVP

Try this 

LOAD 

    OH_ORDER_ID, 

    OH_CREATION_DATE, 

    Time(Floor(OH_CREATION_DATE, 1/24), 'HH') AS Order_Hour

FROM SourceTable;

 

In chart you can use below expression:

Avg(Aggr(Count(DISTINCT OH_ORDER_ID), Order_Hour))

 

View solution in original post

2 Replies
Chanty4u
MVP
MVP

Try this 

LOAD 

    OH_ORDER_ID, 

    OH_CREATION_DATE, 

    Time(Floor(OH_CREATION_DATE, 1/24), 'HH') AS Order_Hour

FROM SourceTable;

 

In chart you can use below expression:

Avg(Aggr(Count(DISTINCT OH_ORDER_ID), Order_Hour))

 

michak80
Contributor III
Contributor III
Author

Thanks you! Seems that it's solution 🙂