Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Cumulative count for chart

Hi, I have a question about count a dimension.

Here is the sample :

IDDate
A1-Jan
B1-Jan
C1-Jan
B2-Jan
C2-Jan
C2-Jan
D2-Jan
C3-Jan
E3-Jan

There are 5 IDs : A,B,C,D,E

I want to make chart that show :

1 Jan has 3 IDs ( That 3 IDs from count distinct 1 Jan : A, B C)

2 Jan has 4 IDs ( That 4 IDs from count distinct 1 Jan to 2 Jan : A, B C,D)

3 Jan has 5 IDs ( That 5 IDs from count distinct 1 Jan to 3 Jan : A, B C,D,E)

Does someone has any idea what kind of expression I could use for this case?

Thanks.

1 Solution

Accepted Solutions
maxgro
MVP
MVP

Tab:

LOAD * INLINE [

ID, Date

A, 1-Jan

B, 1-Jan

C, 1-Jan

B, 2-Jan

C, 2-Jan

C, 2-Jan

D, 2-Jan

C, 3-Jan

E, 3-Jan

];

// new Date2 for chart dimension

Date:

LOAD Distinct Date as Date2 Resident Tab;

Chart

Dimension      Date2

Expression    count(distinct if(Date<=Date2, ID))

View solution in original post

13 Replies
Not applicable
Author

in table with peek()

COUNT =aggr(count(ID),Date)

order table by aggr(count(ID),Date)

PROG = peek(PROG)+COUNT maybe...

in script

table1:

load count(ID) as K, Date resident table group by Date

table2:

load numsum( keep(PROG) ,K) as PROG, * resident Tabella

Not applicable
Author

ok sorry:

TABLE:

LOAD * INLINE [

ID, Data

La, 1-gen

B, 1-gen

C, 1-gen

B, 2-gen

C, 2-gen

C, 2-gen

D, 2-gen

C, 3-gen

E, 3-gen

];

DATE:

LOAD Distinct Data as CALENDAR Resident TABLE Order BY Data;

FOR i = 1 to NoOfFields('DATE')

LET D = Peek('DATE',$(i),'Data');

load ID as ID1, Data Resident TABLE WHERE NOT Exists(ID1,ID);

NEXT i

Not applicable
Author

chart type: BAR CHART

dimension: Data

Count(DISTINCT ID1) with full accumulation

maxgro
MVP
MVP

Tab:

LOAD * INLINE [

ID, Date

A, 1-Jan

B, 1-Jan

C, 1-Jan

B, 2-Jan

C, 2-Jan

C, 2-Jan

D, 2-Jan

C, 3-Jan

E, 3-Jan

];

// new Date2 for chart dimension

Date:

LOAD Distinct Date as Date2 Resident Tab;

Chart

Dimension      Date2

Expression    count(distinct if(Date<=Date2, ID))

Not applicable
Author

così funziona solo se ID non è in nessuna altra tabella della nuvola però.. o sbaglio?

ho sbattuto un sacco di volte la testa su questo tipo di richiesta e mi sono sempre piegato a fare il calcolo sullo script per non impazzire con aggr e balle varie che in 2 passaggi di script risolvo

Not applicable
Author

if we use full accumulation, it will give us

1 jan has 3 IDs

2 jan has 6 IDs

3 jan has 8 IDs

Not applicable
Author

thanks a lot, this is what I meant

Not applicable
Author

Hi Paulus,

take a bar or line and use Date as dimension and count(distinct ID) as expression

and tick cumulative total

best regards

Chris

Not applicable
Author

From where "DATE" field come?