I've a table that shows me the category by state and the start and end date:
and I'm trying to create a conditional column that returns the maximum of each category and status.
I tried to create the column in M
Logic= if [Status] = "InProgress" and [Start] = List.Max(#"Sorted Rows1"[Start]) and [End] = #datetime(2999, 12, 31, 0, 0, 0) then 2 else if [Status] = "Succeeded" then 1 else 0
and it is working correctly except for the case of CategoryG which should only return the value of "2" from the Logic column, and instead it is returning the maximum of the Succeeded status and the InProgress status, where it should only show the InProgress status because it has a longer start date.
I also tried creating in DAX but got the same result (the StartDate is selected as "Earliest" and the EndDate and End Test as "Latest"):
Flag DAX = SWITCH( TRUE (),
'Table'[Start]= MAX ( 'Table'[Start] )
&& 'Table'[End Test] = BLANK ()
&& 'Table'[Status] = "InProgress", 2,
'Table'[Status] = "Failed", 1,
'Table'[Start]= LASTNONBLANK( 'Table'[Start],1 )
&& 'Table'[Status] = "Succeeded" && 'Table'[End Test] <> BLANK (), 3,
Any idea how to solve this ?
Thanks and kind regards.