Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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!
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...
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?
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...