Forum Discussion
Anonymous
7 years agoNot applicable
If based on first date occurrence
Working with Pharmaceutical data. Trying to determine the first occurrence of a prescription as "New" prescription and all successive orders of that prescription as "refills" Each patient will h...
- 7 years ago
Anonymous
Try this for the new column:
NewColumn=
VAR _StartDate = CALCULATE ( MIN ( Query1[Start date of service] ), ALLEXCEPT ( Query1, Query1[Product], Query1[Customer] ) )
RETURN
IF( Query1[Start date of service] = _StartDate, "New", "Refill")
AlB
Community Champion
7 years agoAnonymous
Then
Start Date =
CALCULATE (
MIN ( Query1[Start date of service] ),
ALLEXCEPT ( Query1, Query1[Product], Query1[Customer] )
)should suffice for the start date. You can, within the code for the column, check whether the current row date equals the start date.
AlB
Community Champion
7 years agoAnonymous
Try this for the new column:
NewColumn=
VAR _StartDate = CALCULATE ( MIN ( Query1[Start date of service] ), ALLEXCEPT ( Query1, Query1[Product], Query1[Customer] ) )
RETURN
IF( Query1[Start date of service] = _StartDate, "New", "Refill")
- Anonymous7 years agoNot applicable
That is exactly what I was trying to acheive. Thank You