Thank you. I think in fact 'above' does work with line charts and tables (not pivot though), and it works fine with only one dimension (as in the qvw attatched). Worst case, I will try out other ways of calculating to get the desired result.
PS: It might seem easy to do the calculations in the loadscript with peek function (and it is), but I want all the dynamics from doing the calculations in the objects, e.g. being able to do what-ever selections in various fields. Since the results are dependent on the result from previous calculated field, this would be lost if it was calculated in the loadscript (fixed).
I'd just calculate your cumulative survival by looking at how many are alive at that time vs. the total number. Granted, that's not exactly equivalent to your calculation, but your calculation seems wrong to me. for intance, in Type 1, ID24 did NOT die, yet when ID20 subsequently dies, you go from a 2/7 survival rate to a 0/7 survival rate. That makes no sense to me. Shouldn't the death of ID20 take you to a 1/7 survival rate, as ID24 is still alive, even if she is no longer at risk? I guess I just don't understand what you're doing.
Of if you're saying that ID24 was removed from the population without dying at time 70, then the % should change at that point from 2/7 to 1/6 I'd think, or even all the earlier numbers should be changed to reflect 6 in the population. But that's not hat you're doing either.
Calculated as if the censored=1 are simply survivors, do this to your chart:
- change your calculated dimension to just Timescale
- remove all expressions
- add this expression: count(if(Time>TimeScale or Censored=1,ID))/count(ID)
- stop suppressing zeros
- continuous axis, min=0, max=max(Time)
If that's not exactly what you want, that's still the basic idea I'd use. Just calculate each line separately and not by referring to all the other lines that came above it.
It may also be worth changing your data model to not require an island dimension if you have a lot of data to process, as having a count(if()) will be slow. Since I'm not really understanding your data, I'm not sure what sort of data model you'd want, but I don't mean precalculating anything. I just mean having the right connections in your data model to do the work for you.
I guess the chart does need some more explanation:
The censored records should be included in the caldulations just like the rest until the time of censoring, but should not be included afterwards, all numbers before that remaining as they were. After a censored point, the there will be a bigger decrease per death/failure than before.
It is the censoring part that makes it difficult. I had started with a calculation just as you suggest, calculating points as count of those IDs have Time > TimeScale. The result is great untill the censoring accours.
The plot (Kaplan Meier) is explained in the attached pdf (simple fly example) and is used within pharma/medico industry in medical trials. There, the calculations are done in SAS (Proc Lifetest).
Ok. Went around the problem, by gathering the data to be calculated on, sent it out and did a partial reload with all the calculations in the load script. Works very well. Then, instead of two dimensions and two expressions, I recoded to fit all in two dimensions and one expression instead. Now the graphs look just as I want them to.
Thanks for input guys. Untill next time.