Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

time calculation

Dear all, I have a question about the following. Below is a small table with date-times. I want to show the date_time which is the closest to 07:15. Both the closest before 07:15 and the closest ...
  • Mohammad_Refaei's avatar
    5 years ago

    Try this:

     

    Before 7:15 =
    CALCULATE (
        MAX ( [time_executed] ),
        FILTER (
            YourTable[time_executed],
            YourTable[time_executed] < 'Calendar'[Date] + 0.302083333333333
        )
    )

     

     

     

    After 7:15 =
    CALCULATE (
        MIN ( [time_executed] ),
        FILTER (
            YourTable[time_executed],
            YourTable[time_executed] > 'Calendar'[Date] + 0.302083333333333
        )
    )

     

    P.S.  0.302083333333333 is the numerical value of 7:15 AM