Good afternoon!
I need to return the next value in a sequence, that is, in a training application I need to return the next training session performed by a given user as the initial value. For example, there is a list of training sessions, WORKOUT A, WORKOUT B, WORKOUT C, and the previous training session was WORKOUT C. In this case, I need the initial value returned in the next training session entry to be WORKOUT A.
I am using this method based on a suggestion from this community:
ANY(
SELECT(
treinoPrevisto[treino],[idPrev] = MAXROW("treinoPrevisto", "_RowNumber")
)
)
However, it only returns the last training session performed and not the one following it.
NOTE: the view already has a VALID IF with the user filter:
FILTER("treino",AND([user]=[_THISROW].[user],[status]="Aberto"))
How can I complement the formula so that TREINO A is returned?
Solved! Go to Solution.
Treino Initial Value statement
SWITCH(
ANY(
SELECT(
treinoPrevisto[treino],[idPrev] = MAXROW("treinoPrevisto", "_RowNumber")
)
),
"Treino A", "Treino B",
"Treino B", "Treino C",
"Treino C", "Treino D",
"Treino D", "Treino A",
""
)
IF the list of workouts is added to then this statement will have to maintained as well.
Extending @Trevwiller 's solution, if you have more than one training sequence patterns, you create TRAINING PATTERN, TRAINING PATTERN DETAILS (parent child) tables where the DETAILS table would have fields like
ID, TRAINING_PATTERN_Ref, PREVIOUS_TRAINING, NEXT_TRAINING.
USERS table should recognize which pattern each user is training under.
User | Count |
---|---|
18 | |
11 | |
7 | |
3 | |
2 |