Forum Discussion
Help with a DAX statement to analyze dates
I need Help writing the DAX statement equivalent to the if - then-else logic below
I am attempting to determine a BASE DATE by analyze dates I have in columns in my table
CARGOID RECEIVEDATE ORDER ASSIGN DATE FLEET DEALER BEGIN DATE BASE DATE
1234 09/01/22 08/31/22 09/01/22
9876 09/01/22 09/04/22 09/05/22 09/05/22
8888 09/01/22 09/04/22 09/05/22 09/05/22
5432 09/01/22 09/03/22 09/03/22
1122 09/01/22 09/01/22
If ORDER ASSIGN DATE Is Null then
BASE DATE = Receive Date
else
If ORDER ASSIGN DATE > Receive Date then
If [FLEET DEALER BEGIN DATE] Is Not Null And [FLEET DEALER BEGIN DATE > ORDER ASSIGN DATE then
BASE DATE =[ FLEET DEALER BEGIN DATE],
else
BASE DATE = ORDER ASSIGN DATE
end if
If {FLEET DEALER BEGIN DATE] Is Not Null And [FLEET DEALER BEGIN DATE] > Receive Date , then
BASE DATE = [FLEET DEALER BEGIN DATE],
else
BASE DATE = Receive Date
End if
end if
end if
I tried the below dax code but just can get it to work
2 Replies
- johnt75
Super User
If I understand correcly you want to create a new column which has the max value from 3 other columns on the same table for that row. You can add a column like
Base date = MAXX ( { 'Table'[Receive Date], 'Table'[Order assign date], 'Table'[Fleet dealer begin date] }, [Value] ) - ScottWillRegular Visitor
John, Thank You for the quick
However what I am trying to do is create a measure based on the LOGIC I posted. The Logic is from an access program I have and I am trying to recreate the BASE DATE logic in DAX . So I am trying to see if anyone in the DAX forum group can assist in converting the logic I have posed to a DAX measure statement