Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

fpedrosa
New Contributor II

Count for Aggregate SUM

Hi,

I have a Table with the following information

T1:

Load

Inline

[PL_PLAYER_ID, PL_OPER_TYPE, PL_NR_BALANCE_MOV, DATE

10, 'C', 10, 20171009,

20, 'C', 20, 20171009,

10,'C',15, 20171009,

15, 'D',10, 20171010

12,'C',10,20171110];


I'm trying to create a Dimension CATEGORY which will give me:

= IF( aggr(SUM({$<PL_OPER_TYPE={'C'}>}PL_NR_BALANCE_MOV), [PL_PLAYER_ID] )=0, 'A',

  IF( aggr(SUM({$<PL_OPER_TYPE={'C'}>}PL_NR_BALANCE_MOV), [PL_PLAYER_ID] )<20, 'B','C'))

If SUM of PL_OPER_TYPE=0 -- 'A'

If SUM of PL_OPER_TYPE<20 -- 'B'

If SUM of PL_OPER_TYPE>=20 -- 'C'


After i'm planning to have a Measure which will count the number of PL_PLAYER_ID in each CATEGORY

Measure ==> count(distinct PL_PLAYER_ID)


However when i combine the dimension and the measure gives me strange values and not something like:

CATEGORY          MEASURE

A                     --> 1

B                     -->  1

C                    --> 2


Can anyone help me in what am i doing wrong ?


Thanks in Advance

4 Replies
MVP
MVP

Re: Count for Aggregate SUM

Try this

Dimension

=Aggr(

If(Sum({$<PL_OPER_TYPE={'C'}>}PL_NR_BALANCE_MOV) + Sum({1} 0) = 0, 'A',

If(Sum({$<PL_OPER_TYPE={'C'}>}PL_NR_BALANCE_MOV) < 20, 'B', 'C')), PL_PLAYER_ID)

Expression

=Count(DISTINCT PL_PLAYER_ID)

Capture.PNG

fpedrosa
New Contributor II

Re: Count for Aggregate SUM

It worked perfectly. Many thanks Sunny.

MVP
MVP

Re: Count for Aggregate SUM

I am glad it worked

shraddha_g
Honored Contributor III

Re: Count for Aggregate SUM

Please mark correct answer.. It will help other members.

Qlik Community Tip: Marking Replies as Correct or Helpful