Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

If Statement for Day and Time

Hello,

 

I am trying to build a statement for the below by shift , but with no luck. 

 

A: Sunday-Tuesday 6:00 am-6:00 pm, Wednesday 6:00 am-Noon = Green Days

 

B: Wednesday Noon-6:00 pm, Thursday-Saturday 6:00 am-6:00 pm = Yellow Days

 

C shift Sunday-Tuesday 6:00 pm-6:00 am, Wednesday 6:00 pm-12:00 am = Green Nights

 

D shift Wednesday 12:00 am-6:00 am, Thursday- Saturday 6:00 pm-6:00 am = Yellow Nights

 

 

if Date.DayOfWeek([END_DATE_TIME])=<3 and Time.Hour[END_DATE_TIME])>=6 and Time.Hour([END_DATE_TIME])<16 then "Green Day"

 

Your help is much appreciated. 

1 ACCEPTED SOLUTION
VasTg
Memorable Member
Memorable Member
3 REPLIES 3
VasTg
Memorable Member
Memorable Member

Anonymous
Not applicable

Hello,

 

I wanted to start a new thread since the original thread was solved on my original request. 

 

I am getting an error when trying to insert the dayofweek function. 

 

 

 

amitchandak
Super User
Super User

What is the issue you are getting? Can you share your table structure with sample data.

 

You can also try SWITCH, true

https://community.powerbi.com/t5/Desktop/Help-with-SWITCH-TRUE-with-multiple-items-to-evaluate/td-p/...

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.