Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Replicate IF Formula in DAX

Based on screenshot below, I need the following logic to be replicated in DAX:

IF(Job_Booking_DateTime < 12 midday, IF(hour of Job_Booking_DateTime + hours in Acceptance_Elapsed_Time <24), "Y","N"),"N")

 

 

Here is sample data file

 

Appreciate any help, thanks.

  • Hi Anonymous ,

    If this solves your problem, please mark it as a solution so that others may find it more quickly!

     

    Thank you,

    Nathaniel

7 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    I forgot to mention to exclude weekends in the formula i.e. Saturday and Sunday

  • Nathaniel_C's avatar
    Nathaniel_C
    Icon for Community Champion rankCommunity Champion

     

    Hi Anonymous , 

    Try this.

     

    If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
    Nathaniel

     

    IF(Hour(Job_Booking_DateTime) < 12,
    
    IF(Hour(Job_Booking_DateTime) + Hour(Acceptance_Elapsed_Time ) <24,
    
    "Y","N"),"N")
    • Nathaniel_C's avatar
      Nathaniel_C
      Icon for Community Champion rankCommunity Champion

      Hi Anonymous ,

      Which column would you like to use for the weekend specification.

      If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
      Nathaniel

      • Nathaniel_C's avatar
        Nathaniel_C
        Icon for Community Champion rankCommunity Champion

        Hi Anonymous ,

        Wrap this around the above formula, and fill in the date.

         

        If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
        Nathaniel

         

        If (WEEKDAY(Date, 2) = 6 || WEEKDAY(Date,2) = 7, “”,The formula applied above)