Forum Discussion

Julius410's avatar
Julius410
Frequent Visitor
4 years ago
Solved

IF AND STATEMENT DATE & TIME

Hi there,

 

I have problem that I can solve in Excel but not in Power BI and I am hoping that someone could help me to figure out a way to solve this.

 

I have three columns: date, time, and event. I would like to create another column that only considers events that happened between 5:00:01AM and 5:00:00 AM the next day - matching with the selected dates in my date slicer. For example, my date slicer has the 2nd of June 2022 selected. I would only like to consider events that happened between the 2nd of June 05:00:01 AM and the 3rd of June 2022 5:00:00 AM.

 

In Excel my formula would like this:

 

=IF(AND([@[F_Date/Time]]<=Slicer!$C$5,[@[F_Date/Time]]>Slicer!$C$11),"TRUE","FALSE")

 

Thank you.

 

Julius

  • Julius410 , Create a new date column and use that for analysis or join with date table

     

    New Date  = if([time] <=time(5,0,0), [Date] -1, [Date])

2 Replies

  • Julius410 , Create a new date column and use that for analysis or join with date table

     

    New Date  = if([time] <=time(5,0,0), [Date] -1, [Date])