Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
ScottWill
Regular Visitor

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 

 

Base Date  =
IF (isblank(MAX(Inventory[ORDERASSIGNMENTDATE])), --then
    MAX(Inventory[RECEIVEDATE]),
-- else
       IF (not(isblank(MAX(Inventory[FLEETDELIVERYBEGINDATE]))) && IF (MAX(Inventory[FLEETDELIVERYBEGINDATE]) >          (MAX(Inventory[ORDERASSIGNMENTDATE])), -- then
            Max(Inventory[FLEETDELIVERYBEGINDATE]),
        --else
            MAX(Inventory[ORDERASSIGNMENTDATE])
        --endif
       )
    || -- not sure if this is correct use of the ||
 
    IF (not(isblank(MAX(Inventory[FLEETDELIVERYBEGINDATE]))) && If (Max(Inventory[FLEETDELIVERYBEGINDATE]) > (MAX(Inventory[RECEIVEDATE])),  ---then
            Max(Inventory[FLEETDELIVERYBEGINDATE]), ----
        --else
             MAX(Inventory[RECEIVEDATE])
           )
        --endif
  -- endif
 
 
Any assistance would be greatly appreciated
 
Thank You 
2 REPLIES 2
ScottWill
Regular 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 

 

johnt75
Super User
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]
)

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.