'How to add a user-input value to each row in a column in PowerBI
I'm new to PowerBI, so please forgive, if this is a very simple question.
I have a dataframe that holds information on patients, a timestamp for a visit at a hospital dept, which type of visit and if the amount of time between their first visit and last visit meet a certain criteria for the amount of time between the two. I created an index to be able to calculate the # of days betweeen each row's visit and the visit in the previous row. The duration is calculated based on the sum of days between visits for each single patient and the OF4-criteria is checking if the duration is above or below a certain threshold. It looks something like this:
| ID | Timestamp | Event | Index | Days_since_last_visit | Duration | OF4-criteria |
|---|---|---|---|---|---|---|
| 01257 | 11-10-2021 | CT-scan | 0 | 0 | 79 | Not met |
| 01257 | 02-11-2021 | PET-scan | 1 | 22 | 79 | Not met |
| 01257 | 29-12-2021 | F-code | 3 | 47 | 79 | Not met |
| 5789 | 24-11-2021 | CT-scan | 4 | 0 | 29 | Met |
| 5789 | 7-12-2021 | ECG | 5 | 13 | 29 | Met |
and so on...
My goal is to be able to create a slider, so that I can play around with the # of days between visits and investigate, what happens with the ratio of patients that meet og don't meet the OF4-criteria. I created a "what-if" parameter for the user to input an amount of days, that I want to subtract from the variable duration, but I can't use the input to calculate a new column, since it is a measure and only can be used in other measures. Ideally what I want is to be able to create a new column named "what-if-duration", that is calculated with the original column "duration" and has the number of days subtracted.
Does anyone know a way to do this?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
