This is best Fabric, Power BI, SQL and AI community event. How do we know? The last event sold out! Save €200 with code FABCMTY200.
Register nowA new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.
Hi, I have a table with timestamp and Im trying to build the logic, if the time is between 20:15 and 8:14 it's "night shift", else, it's" day shift". I tool the hour to different column but the logic doesnt work. Test = if(and('Cust Order Cube'[Create Time]>=TIME(20,15,0),'Cust Order Cube'[Create Time]<=TIME(8,14,59)),"Night","Day") any idea?
Solved! Go to Solution.
@gkakun , Logic seem right. Try Or and Try with .time
Test = if(OR('Cust Order Cube'[Create Time]>=TIME(20,15,0),'Cust Order Cube'[Create Time]<=TIME(8,14,59)),"Night","Day")
Test = if('Cust Order Cube'[Create Time].time>=TIME(20,15,0) || 'Cust Order Cube'[Create Time].time<=TIME(8,14,59),"Night","Day")
Hi, @gkakun
Here I use field [Create Date] rather than [Create Time] to create a calculated column as below:
Test =
IF (
AND (
FORMAT ( 'Cust Order Cube'[Create Date], "hh-mm-ss" )
>= FORMAT ( TIME ( 20, 15, 0 ), "hh-mm-ss" ),
FORMAT ( 'Cust Order Cube'[Create Date], "hh-mm-ss" )
<= FORMAT ( TIME ( 8, 14, 59 ), "hh-mm-ss" )
),
"Night",
"Day"
)
Best Regards,
Community Support Team _ Eason
@gkakun , Logic seem right. Try Or and Try with .time
Test = if(OR('Cust Order Cube'[Create Time]>=TIME(20,15,0),'Cust Order Cube'[Create Time]<=TIME(8,14,59)),"Night","Day")
Test = if('Cust Order Cube'[Create Time].time>=TIME(20,15,0) || 'Cust Order Cube'[Create Time].time<=TIME(8,14,59),"Night","Day")
Check out the May 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 27 | |
| 25 | |
| 22 | |
| 20 | |
| 14 |
| User | Count |
|---|---|
| 51 | |
| 47 | |
| 23 | |
| 18 | |
| 18 |