Forum Discussion

cchp07's avatar
cchp07
Frequent Visitor
6 years ago
Solved

IF Between 2 Times & Two Dates Then Date Otherwise Another Date

I have a table that pulls date, time and value. I want to create a column that puts the date  IF(time is between 7:00 a.m. and 7:00 pm. on the same day && time is between 7:00 p.m. (on the same day) ...
  • AlB's avatar
    6 years ago

    hi cchp07 

    Try this. You might have to convert the resulting column to date type

    EndResult =
    VAR CutOffTime_ = ( 1 / 24 ) * 7 // 7 AM
    RETURN
        IF (
            Table1[Time] - Table1[Date] >= CutOffTime_,
            Table1[Date],
            Table1[Date] - 1
        )

     

    Please mark the question solved when done and consider giving kudos if posts are helpful.

    Cheers  Datanaut