Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
Suppose that I have some data like below table:
| cluster /date | 2015/01 | 2015/02 |
|---|---|---|
| cluster1 | 123 | 258 |
| cluster2 | 224 | 325 |
| cluster3 | 123 | 158 |
| cluster4 | 220 | 426 |
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?
Front end option can be done using this expression: =Sum(Data)/Sum(TOTAL <MonthYear> Data)
Are you wanting to do this in the script or front end?
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:
Front end option can be done using this expression: =Sum(Data)/Sum(TOTAL <MonthYear> Data)
see the attachment....
Dear pradeept
Thank you for your answer.
Your answer was right, but I have to choose Suuny's answer because he answered my question first!
Best Regards,
Zahra
Dear Sunny,
Thank you a lot for your kind help.
Best,
Zahra