Forum Discussion
kattlees
Post Patron
8 years agoAdding sequence column based on time and surgeon
If I have a table that lists surgeon name, OR, Start Time like this: JONES JANE OR 6 9:00 JONES JANE OR 5 7:45 JONES JANE OR 6 7:00 JONES JANE OR 5 11:45 JONES JANE OR 6 ...
- 8 years ago
I was able to figure out my own answer by piecing together other answers.
I gave each case of the day a rank by surgeon:
PreviousRowSales = VAR Index = Table1[Rank] - 1 RETURN CALCULATE ( SUM ( Table1[Current Month Sales] ), FILTER ( ALLEXCEPT ( Table1, Table1[Customer] ), Table1[Rank] = Index ) )Then got this calculated column:
PreviousMDOut =
VAR Index = V_EWS_TASK_RECORD[Rank] - 1
VAR SDATE = V_EWS_TASK_RECORD[OR Times Final.SCHDT]
RETURN
CALCULATE (
SUM ( V_EWS_TASK_RECORD[MD out] ),
FILTER ( ALLEXCEPT ( V_EWS_TASK_RECORD, V_EWS_TASK_RECORD[OR Times Final.SURGEON] ), V_EWS_TASK_RECORD[Rank] = Index && V_EWS_TASK_RECORD[OR Times Final.SCHDT]=SDATE)
)
Greg_Deckler
Community Champion
8 years agoThis one does it by OR:
Rank2 = RANKX(FILTER(ALL(Surgeries),[OR]=EARLIER([OR])),[Time],,ASC)