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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to calculate share of each cluster in a specific month?

Hi all,

Suppose that I have some data like below table:

cluster /date2015/012015/02
cluster1123258
cluster2224325
cluster3123158
cluster4220426

Now I want to calculate the share of cluster 1 and 2 in each month:

in 2015/01 share of cluster 1 is equal to:  123/(123+224+123+220)  and in 2015/02 share of cluster 1  is equal to: 258/(258+325+158+426)

could you please help me that how can I write this in Qlikview?

1 Solution

Accepted Solutions
sunny_talwar

Front end option can be done using this expression: =Sum(Data)/Sum(TOTAL <MonthYear> Data)

Capture.PNG

View solution in original post

6 Replies
sunny_talwar

Are you wanting to do this in the script or front end?

sunny_talwar

In the script option:

Table:

CrossTable(MonthYear, Data)

LOAD [cluster /date],

    [2015/01],

    [2015/02]

FROM

[https://community.qlik.com/thread/181539]

(html, codepage is 1252, embedded labels, table is @1);

Temp:

NoConcatenate

LOAD [cluster /date],

  MonthYear,

  Data

Resident Table;

Join(Temp)

LOAD Sum(Data) as TotalData,

  MonthYear

Resident Temp

Group By MonthYear;

NewTable:

LOAD *,

  Data/TotalData as Percentages

Resident Temp;

DROP Tables Temp, Table;

Output in Table Box Object:

Capture.PNG

sunny_talwar

Front end option can be done using this expression: =Sum(Data)/Sum(TOTAL <MonthYear> Data)

Capture.PNG

PradeepReddy
Specialist II
Specialist II

see the attachment....

Not applicable
Author

Dear

Not applicable
Author

Dear Sunny,

Thank you a lot for your kind help.

Best,

Zahra