# QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Join this live chat April 6, 10AM EST - QlikView to Qlik Sense REGISTER
cancel
Showing results for
Did you mean:
Contributor III

## Calulate a percentage matrix in a set-analysis

Hei

i have one matrix with municipality numers vertically and the number of students on each of four schools horisontally. Like this:

Table1:
Mnr, S1, S2, S3,S4
1, 18, 2, 10, 1
2, 12, 13, 4, 4
3, 9, 12, 6, 15
4, 3, 17, 5, 11
];

As well I have a table with the expected population in each municipalty next year. Like this:

Table2:
Mnr, Population_nextYear
1, 35
2, 31
3, 52
4, 25
];

I then want to "spread" the population i each municipality next year according to the school-preference in Table1. This means i have to calculate the percentage per school per municipality (each municipalyt should sum to 100%) from Table1, and then multiply each school-percentage with the expected population next year in the relevant municipality from Table2. The result should than be a Table3 with the four Mnr vertically and the four schools horisontally, populated with the number of students based on the population next year.

I want to do this in a set analysis. How can i do this?

Regards,
Torbjørn

3 Replies
MVP

Currently there are 31 students in Mnr = 1 and next year you will have 35. So, based on the percentage for S1 = 18/31, you expect to see 18*35/31 = 20 students or 21 students because the number that you get is in decimals (20.32258)

Contributor III
Author

Hi,

yes, I do understand the math in this. But the question is how it can be done as a set analysis.

Regards,
Torbjørn

MVP

huh?? I am asking what the result you want to get? I am sure you know the math behind it, but can you teach us the math behind it 🙂