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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
stevegimbrollmt
Creator II
Creator II

Group and Count Expression

Hi guys,

I am not how I go about this, even how to title it

So let me try and explain. Take this example

YearMonthDateActive PlayersGame AGame BNumberofGamesPlayed
2014-1028/10/201450848418502
2014-1027/10/20142,0112,067562,123
2014-1026/10/20142,1602,229472276
2014-1025/10/20141,8751,907481955
2014-1024/10/20141,8211,817421859
837585042118715

So if  Player X plays Game Product A 10 times in a month and plays on Game Product B 10 times.  The value of NumberOfGamesPlayed would be 2. not 20


And for the active number of players in a month (8375 in the example above I need to know the average of all players value for NumberOfGamesPlayed - the average number of Games  Product played



How can I go about this, I have tried using AGGR to check if GameA>0 than 1 and than try and Sum that but its not working


1 Solution

Accepted Solutions
stevegimbrollmt
Creator II
Creator II
Author

Hi Massimo Thanks a lot

That is helpful and I think I am on the correct track, I am at the moment trying it out.

Basically from that table

I would end up having like

YearMonth     Date   Game A Game B

2014-10         8375  1000       500

Because lets say Player 1 who played 30 times in a month, it would count as 1 for GAME A, and maybe another 1 for Game B so in all it would be 2 ,

View solution in original post

3 Replies
maxgro
MVP
MVP

I suppose your source data is

Player, YearMonth, Date, Game A, Game B

with YearMonth as dimension

expression maybe

sum(aggr(rangesum(if(SUM([Game A])>0,1), if(sum([Game B])>0,1)), YearMonth, Player))

stevegimbrollmt
Creator II
Creator II
Author

Hi Massimo Thanks a lot

That is helpful and I think I am on the correct track, I am at the moment trying it out.

Basically from that table

I would end up having like

YearMonth     Date   Game A Game B

2014-10         8375  1000       500

Because lets say Player 1 who played 30 times in a month, it would count as 1 for GAME A, and maybe another 1 for Game B so in all it would be 2 ,

stevegimbrollmt
Creator II
Creator II
Author

Massimo

Just wanted to confirm that what I have asked for, and what you answered is very very close to what is needed, I say almost, because it does exactly what it needs, I just need to think of extra logic for the next step.

Thank you. mission accomplished on this one.

Steve