Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi I am using data which kinda looks like this:
category week
1 1
2 1
1 3
1 4
2 6
Now, I want a line graph that shows percentage of 2's.
so for week 1 - 50%, week 2 - 50%, week 3 - 33.33%, week 4 - 25%, week 5 - 25%, week 6 - 40% and so on. The values I am currently getting are:
week 1 - 50%, week 2 -0%, week 3 - 0, week 4 - 0 week 5 - 0, week 6 - 100%
can this be done? Thanks!
Okay now I get it. You need cumulative sums with rangesum(above())
Try this as measure with week as dimension:
RangeSum(Above((count(if(category = 2,1))),0,RowNo()))
/RangeSum(Above(count(if(category,1)),0,RowNo()))
Can u explain a bit more about your calculation condition? How do you want 50% for 2's ?
i assume you are getting confused over the week 1 values. there are 2 entries for week 1, but only one of them is category 2, thats why i get 50% in that. in week 2 there are no new entries so the value remains 50%. In week 3 an entry is added in category 1, now the total no. of entries will be 3, and only one of them will be of category 2, hence 33.33% and so on.
Okay now I get it. You need cumulative sums with rangesum(above())
Try this as measure with week as dimension:
RangeSum(Above((count(if(category = 2,1))),0,RowNo()))
/RangeSum(Above(count(if(category,1)),0,RowNo()))
thanks mate!!!