Forum Discussion
Recovery curve
hi all,
i have a table with all our sickness data and i want to create a yearly recovery curve. The table looks like this;
| Sickness ID | Start date | Recovery date | Is Recovered | # Sickness days |
| 001 | 01-01-2021 | 01-09-2021 | 1 | 244 |
| 002 | 01-10-2021 | 02-10-2021 | 1 | 2 |
| 003 | 01-11-2021 | 08-11-2021 | 1 | 8 |
| 004 | 01-05-2021 | |||
| 005 | 01-07-2021 | 01-09-2021 | 1 | 63 |
| 006 | 01-01-2022 | 01-02-2022 | 1 | 32 |
| 007 | 01-03-2022 | 4-03-2022 | 1 | 4 |
| 008 | 01-04-2022 | 01-04-2022 | 1 | 1 |
| 009 | 01-05-2022 | |||
| 010 | 01-05-2020 | 20-03-2022 | 1 | 689 |
| Etc |
This table contains about 500k rows 🙂
i want to create the number of recovered cases as % of the total number of recovered cases in a year, per day, so:
2021: number of recovered cases = 4 ( formula = calculate(sum(isRecovered),userelationship(date table(date),recovery date))
2022: number of recovered cases = 4
| Day | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 100 | 720 |
| 2021 | 0% | 25% | 25% | 25% | 25% | 25% | 25% | 50% | 50% | 75% | 100% |
| 2022 | 25% | 25% | 25% | 50% | 50% | 50% | 50% | 50% | 50% | 75% | 100% |
So i want a X axis with number 1 to 720 (maximum # number of sickness days in our country) and on Y axis the cumulated recovery %.
Does anybody have a solution for the second formula to create a cumulated recovery line?
Many thanks in advance,
Regards,
Frank
- Anonymous3 years ago
HI
I get this for you in 2 measures
Percentagerecov2021 =VAR compteurvalue =SELECTEDVALUE ( Compteur[Value] )VAR nbrecovtotal =CALCULATE (SUM ( Recovery[Is Recovered] ),Recovery[Yearsd] = 2021)VAR result =DIVIDE (CALCULATE (CALCULATE (SUM ( Recovery[Is Recovered] ),Recovery[Yearsd] = 2021&& Recovery[# Sickness days] <= compteurvalue)),nbrecovtotal)RETURNresultPercentagerecov2022 =VAR compteurvalue =SELECTEDVALUE ( Compteur[Value] )VAR nbrecovtotal =CALCULATE (SUM ( Recovery[Is Recovered] ),Recovery[Yearsd] = 2022)VAR result =DIVIDE (CALCULATE (CALCULATE (SUM ( Recovery[Is Recovered] ),Recovery[Yearsd] = 2022&& Recovery[# Sickness days] <= compteurvalue)),nbrecovtotal)RETURNresultI just add a column with the year on the table
2 Replies
- AnonymousNot applicable
HI
I get this for you in 2 measures
Percentagerecov2021 =VAR compteurvalue =SELECTEDVALUE ( Compteur[Value] )VAR nbrecovtotal =CALCULATE (SUM ( Recovery[Is Recovered] ),Recovery[Yearsd] = 2021)VAR result =DIVIDE (CALCULATE (CALCULATE (SUM ( Recovery[Is Recovered] ),Recovery[Yearsd] = 2021&& Recovery[# Sickness days] <= compteurvalue)),nbrecovtotal)RETURNresultPercentagerecov2022 =VAR compteurvalue =SELECTEDVALUE ( Compteur[Value] )VAR nbrecovtotal =CALCULATE (SUM ( Recovery[Is Recovered] ),Recovery[Yearsd] = 2022)VAR result =DIVIDE (CALCULATE (CALCULATE (SUM ( Recovery[Is Recovered] ),Recovery[Yearsd] = 2022&& Recovery[# Sickness days] <= compteurvalue)),nbrecovtotal)RETURNresultI just add a column with the year on the table- frankhofmansHelper IV
hi James,
this works perfect. I created an extra table with only a colum day (with 1 till 520) and used your formula (and changed the year into a userelationship end date). It's exactly the output i needed.
Many thanks!