Forum Discussion
How to pull date from another table based on complex if statement
- 2 years ago
Create a calculated column to get the occurrence
Occurrence Order = VAR CurrentID = 'Table'[ID] VAR CurrentDate = 'Table'[ACTIVITY_DATE] RETURN COUNTROWS( FILTER( 'Table', 'Table'[ID] = CurrentID && 'Table'[ACTIVITY_DATE] <= CurrentDate ) )and create another calculated column to to do the grouping
New Column 2 = VAR OccurrenceNumber = 'Table'[Occurrence Order] VAR ScoringCategory = 'Table'[SCORING CATEGORY] RETURN SWITCH( TRUE(), OccurrenceNumber = 4, "Moderate", OccurrenceNumber = 5, "High", OccurrenceNumber = 6, "Critical", OR(ISBLANK(ScoringCategory), ScoringCategory = ""), "IBT-" & OccurrenceNumber, ScoringCategory )and use a matrix table and add the following fields
Hi , add a >= 6 then it will stop from 6 , and change the matrix table values to latest so it will show the last occurrence date
New Column 2 =
VAR OccurrenceNumber = 'Table'[Occurrence Order]
VAR ScoringCategory = 'Table'[SCORING CATEGORY]
RETURN
SWITCH(
TRUE(),
OccurrenceNumber = 4, "Moderate",
OccurrenceNumber = 5, "High",
OccurrenceNumber >= 6, "Critical",
OR(ISBLANK(ScoringCategory), ScoringCategory = ""), "IBT-" & OccurrenceNumber,
ScoringCategory
)
Would there be a way to prevent an occurence number from going backwards. Sorry, I think I worded that incorrectly. Essentially looking at this below, once an ID is "Critical" then that should be the last date populated. Meaning no date after that would be placed in one of the previous columns. So by order of events (IBT-1, IBT-2,IBT-3, Moderate, High, Critical) the dates should always run from oldest to newest in the table
What currently shows:
What should show: