Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
charlie03
Contributor II
Contributor II

Calculate % out of total in a table, based on two dimensions

Hi,

I've got a table with two dimensions and I want to include a measure, which calculates the percentage out of total. 

Here a small example of what i have:

week_id c_sub_type # Churn % of Churn out of total
202238 Fixed 110 26.8% (110 / (110 + 300) )
202238 Mobile 300 73.2% (300 / (110 + 300) )
202239 Fixed 150 39.0% (150 / (150 + 235) )
202239 Mobile 235 61.0% (235 / (150 + 235) )

 

To calculate the "# Churn", I use the following formula:

 

 

sum(count_c_execution)

 

 

In order to calculate the percentage, I have tried multiple options, however, none of them give me the correct result. Here what I've tried so far:

 

 

sum(count_c_execution) /
sum(total count_c_execution)

 

 

 

 

 

sum(count_c_execution) /
sum(total <week_id> count_c_execution)

 

 

 

 

 

sum(count_c_execution)/
sum(total <week_id, c_sub_type> count_c_execution)
sum(count_c_execution) / 
Aggr(sum(count_c_execution), week_id)
sum(count_c_execution)/
sum(Aggr(sum(total count_c_execution), week_id, c_sub_type))

 

 

 Any help would be more than appreciated!

Thanks!

Labels (2)
1 Solution

Accepted Solutions
charlie03
Contributor II
Contributor II
Author

Hi,

I ended up deleting the table and creating a new one, inserting the same dimensions and measures and it worked. The results I was getting were a % of the total sum of all weeks, and not per week...

 

View solution in original post

2 Replies
jbhappysocks
Creator II
Creator II

Hi

Based on how you describe it your second suggestion looks correct.

sum(count_c_execution) /
sum(total <week_id> count_c_execution)

 

What result do you get when you try this?

 

charlie03
Contributor II
Contributor II
Author

Hi,

I ended up deleting the table and creating a new one, inserting the same dimensions and measures and it worked. The results I was getting were a % of the total sum of all weeks, and not per week...