Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
saumyashah90
Specialist
Specialist

cross table and aggregation

I have a excel.PFA,

     

USERDateDurationHitsUser Selection
U107/12/201532.23112
U207/12/201550.85330
U307/12/2015126.37436
U407/12/201563.93216
U507/12/2015122.931092
U607/12/201589.17224
U707/12/201539.95335
U804/12/201565.73424
U904/12/2015134.90234
U1004/12/201571.30219
U1104/12/201519.608100

i need output as

 

UserLast LoginAverage login per session (mins)No. of times login
JanFebMarAprMayJunJulAugSepOctNovDec
U103/12/20151420000010123
U203/12/20152120003010123
U302/12/20155120020310123
U401/12/20156120020010123
U501/12/20157323000010123
8 Replies
sunny_talwar

I don't see anything attached. Can you please reattach it?

effinty2112
Master
Master

Hi Saumya,

This would be easier with an xls file to work with and a definition of what comprises a session, a Hit or a User Selection?

Anyway you can do this with a pivot table if you create the aggregate fields Last Login, and Average Login in the script first and create a Month field too. 

Data:

Load

USER,

Date(Date) as Date,

Duration,

Hits,

[User Selection],

Month(Date) as Month;

LOAD * INLINE [

    USER, Date, Duration, Hits, User Selection

    U1, 07/12/2015, 32.23, 1, 12

    U2, 07/12/2015, 50.85, 3, 30

    U3, 07/12/2015, 126.37, 4, 36

    U4, 07/12/2015, 63.93, 2, 16

    U5, 07/12/2015, 122.93, 10, 92

    U6, 07/12/2015, 89.17, 2, 24

    U7, 07/12/2015, 39.95, 3, 35

    U8, 04/12/2015, 65.73, 4, 24

    U9, 04/12/2015, 134.9, 2, 34

    U10, 04/12/2015, 71.3, 2, 19

    U11, 04/12/2015, 19.6, 8, 100

];

Aggregate:

LOAD

USER,

Date(Max(Date)) as LastLogin,

Round(Sum(Duration)/Sum(Hits)) as [Avg Login] //Replace with the correct definition if necessary

Resident Data

Group by USER;

Now you can make a pivot table like this. USER, LastLogin, Avg Login and Month are dimensions. The expression Sum(Hits) is used here for No of Logins, I don't know if that is the definition you are using:

USER LastLogin Avg Login Month Dec
U107/12/201532 1
U207/12/201517 3
U307/12/201532 4
U407/12/201532 2
U507/12/201512 10
U607/12/201545 2
U707/12/201513 3
U804/12/201516 4
U904/12/201567 2
U1004/12/201536 2
U1104/12/20152 8
saumyashah90
Specialist
Specialist
Author

so sorry to not attach

PFA

saumyashah90
Specialist
Specialist
Author

This doesnt work.

This hits repeats for everymonth

PrashantSangle

Hi,

Can you tell us logic behind it.

Regards,

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
effinty2112
Master
Master

Hi Saumya,

In your xls file each user has only one record so aggregating this across the user dimension is not telling us anything.

nagarjuna_kotha
Partner - Specialist II
Partner - Specialist II

Like this ??

PFA

nagarjuna_kotha
Partner - Specialist II
Partner - Specialist II

i'm not sure that above is correct.

Explain clearly about your question and logic of expression. thn only we can provide better result

-Nagarjuna