Forum Discussion
ChrisPfP
4 years agoRegular Visitor
find value at calculated date
I need to find a value based on a calculated date - ie what was [NewValue] on the first instance it was one of "Put it Right", "Stage 1" , "Stage 2" or "Stage 3". This is the measure I'm using to fin...
- 4 years ago
Please try
FirstStageDate = VAR CurrentIDTable = CALCULATETABLE ( 'History: Complaint', ALLEXCEPT ( 'History: Complaint', 'History: Complaint'[ParentId] ) ) VAR FilteredTable = FILTER ( CurrentIDTable, 'History: Complaint'[NewValue] = "Put it Right" || 'History: Complaint'[NewValue] = "Stage 1" || 'History: Complaint'[NewValue] = "Stage 2" || 'History: Complaint'[NewValue] = "Stage 3" ) VAR MinDate = MINX ( FilteredTable, 'History: Complaint'[CreatedDate] ) RETURN MAXX ( FILTER ( FilteredTable, 'History: Complaint'[CreatedDate] = MinDate ), 'History: Complaint'[Value] )
tamerj1
4 years agoCommunity Champion
Hi ChrisPfP
Please try
FirstStageDate =
CALCULATE (
MIN ( 'History: Complaint'[CreatedDate] ),
ALLEXCEPT ( 'History: Complaint', 'History: Complaint'[ParentId] ),
FILTER (
'History: Complaint',
'History: Complaint'[NewValue] = "Put it Right"
|| 'History: Complaint'[NewValue] = "Stage 1"
|| 'History: Complaint'[NewValue] = "Stage 2"
|| 'History: Complaint'[NewValue] = "Stage 3"
)
)- ChrisPfP4 years agoRegular Visitor
Thanks but this isn't showing me the [NewValue] value that I need to see
- tamerj14 years agoCommunity Champion
Please try
FirstStageDate = VAR CurrentIDTable = CALCULATETABLE ( 'History: Complaint', ALLEXCEPT ( 'History: Complaint', 'History: Complaint'[ParentId] ) ) VAR FilteredTable = FILTER ( CurrentIDTable, 'History: Complaint'[NewValue] = "Put it Right" || 'History: Complaint'[NewValue] = "Stage 1" || 'History: Complaint'[NewValue] = "Stage 2" || 'History: Complaint'[NewValue] = "Stage 3" ) VAR MinDate = MINX ( FilteredTable, 'History: Complaint'[CreatedDate] ) RETURN MAXX ( FILTER ( FilteredTable, 'History: Complaint'[CreatedDate] = MinDate ), 'History: Complaint'[Value] )