Hi all,
A more complex question.
I have a table (patients) that either drop out of the research (cured / died => status=0) in a certain interval OR develop a specific disease (status=1). Of course, the table holds content on which disease and which patient, whether it is first time, and so on. But that's not important for the question.
So, imagine the following (very simply) table:
INTERVAL STATUS
1 1
1 0
1 1
1 0
1 1
1 1
2 1
2 1
2 1
2 0
2 0
2 1
Now, I need to survival chance.
Total N = 12. In interval 1, 2 patients drop out, 4 are registered diseases. So, the survival chance is calculated as follows:
For interval 1, since not all drop-out at the same time, we average this over the year. So, a corrected N' is N - 0.5*dropout = 12 - 0.5*2 = 11
For interval 2, start N is 12 - 6 (everybody from time interval 2) - 0.5 * dropout = 5.
The survival change for interval i then is defined as: (1 - #with_status_1/N') * product_previous_chances.
So, for interval 1, the value is 1 - (4/11) = 0,636
For time interval 2, the value is (1 - (4/5)) * 0,636 = 0,127
I've created a set of measures that calculate these. I want to zoom in on the survival chance.
I now retrieve earlier values with the following DAX formula (example for retrieve 1 interval earlier value).
CALCULATE(AVERAGEX(VALUES(Table[interval]), 1-Table[Count of status]/Table[N']), Table[interval]= VALUES(Table[interval]) - 1))
That latter -1 identifies the previous value.
However, my range of intervals is 10, I have sets per interval of about 200,000 patients, and you can imagine performance drops dramatically. For 2 intervals the measure (little but simplified) becomes:
CALCULATE(AVERAGEX(VALUES(Table[interval]), 1-Table[Count of status]/Table[N']), Table[interval]= VALUES(Table[interval])))
*
CALCULATE(AVERAGEX(VALUES(Table[interval]), 1-Table[Count of status]/Table[N']), Table[interval]= VALUES(Table[interval]) - 1))
Question: can this be done smarter? Maybe using the EARLIER function, although I fail to see how I can do a product (instead of sum, count).
Any help is greatly appreciated, sorry for the long post.
Kind regards,
Edward
A more complex question.
I have a table (patients) that either drop out of the research (cured / died => status=0) in a certain interval OR develop a specific disease (status=1). Of course, the table holds content on which disease and which patient, whether it is first time, and so on. But that's not important for the question.
So, imagine the following (very simply) table:
INTERVAL STATUS
1 1
1 0
1 1
1 0
1 1
1 1
2 1
2 1
2 1
2 0
2 0
2 1
Now, I need to survival chance.
Total N = 12. In interval 1, 2 patients drop out, 4 are registered diseases. So, the survival chance is calculated as follows:
For interval 1, since not all drop-out at the same time, we average this over the year. So, a corrected N' is N - 0.5*dropout = 12 - 0.5*2 = 11
For interval 2, start N is 12 - 6 (everybody from time interval 2) - 0.5 * dropout = 5.
The survival change for interval i then is defined as: (1 - #with_status_1/N') * product_previous_chances.
So, for interval 1, the value is 1 - (4/11) = 0,636
For time interval 2, the value is (1 - (4/5)) * 0,636 = 0,127
I've created a set of measures that calculate these. I want to zoom in on the survival chance.
I now retrieve earlier values with the following DAX formula (example for retrieve 1 interval earlier value).
CALCULATE(AVERAGEX(VALUES(Table[interval]), 1-Table[Count of status]/Table[N']), Table[interval]= VALUES(Table[interval]) - 1))
That latter -1 identifies the previous value.
However, my range of intervals is 10, I have sets per interval of about 200,000 patients, and you can imagine performance drops dramatically. For 2 intervals the measure (little but simplified) becomes:
CALCULATE(AVERAGEX(VALUES(Table[interval]), 1-Table[Count of status]/Table[N']), Table[interval]= VALUES(Table[interval])))
*
CALCULATE(AVERAGEX(VALUES(Table[interval]), 1-Table[Count of status]/Table[N']), Table[interval]= VALUES(Table[interval]) - 1))
Question: can this be done smarter? Maybe using the EARLIER function, although I fail to see how I can do a product (instead of sum, count).
Any help is greatly appreciated, sorry for the long post.
Kind regards,
Edward