# QlikView Layout & Visualizations

Discussion Board for collaboration on QlikView Layout & Visualizations.

Announcements
Not applicable

## Cumulative count for chart

Hi, I have a question about count a dimension.

Here is the sample :

 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

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.

Tags (3)
1 Solution

Accepted Solutions
MVP

## Re: Cumulative count for chart

Tab:

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))

13 Replies
Not applicable

## Re: Cumulative count for chart

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

## Re: Cumulative count for chart

ok sorry:

TABLE:

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

## Re: Cumulative count for chart

chart type: BAR CHART

dimension: Data

Count(DISTINCT ID1) with full accumulation

MVP

## Re: Cumulative count for chart

Tab:

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

## Re: Cumulative count for chart

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

## Re: Cumulative count for chart

if we use full accumulation, it will give us

1 jan has 3 IDs

2 jan has 6 IDs

3 jan has 8 IDs

Highlighted
Not applicable

## Re: Cumulative count for chart

thanks a lot, this is what I meant

Not applicable

## Re: Cumulative count for chart

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

## Re: Cumulative count for chart

From where "DATE" field come?