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

Did you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now

Reply
ranz_vincent
Helper I
Helper I

Getting Delivery Status based on Specific Time Window

Having problems again with data that uses time. I wanted to see if our deleveries are arriving within a specific time window per customer but the problem is there are no Late results showing from my conditional column. "time_arrived_to_store" should be within "Sheet1.DRY - Arrival Time From" and "Sheet1.DRY - Arrival Time To". One data that I saw was delivery was made at 6am and the window was 4pm to 10pm it should be late but it was tagged on time

ranz_vincent_0-1733207930984.png

ranz_vincent_1-1733207953517.png

 

 

1 ACCEPTED SOLUTION
shafiz_p
Super User
Super User

Hi @ranz_vincent  You said, "time_arrived_to_store" should be within "Sheet1.DRY - Arrival Time From" and "Sheet1.DRY - Arrival Time To" meaning boundary, so you need to use AND condition but you have used OR. So any condition which is true will return result and discarded other condition.

Your mentioned specific case, 6 am comes before 4 or 10 pm, and in both the condition your return result is on time. So, arrived time to store is less than 10 PM , condition 2 is true and returned "On Time", and it discarded other condition.

 

This formula works as follows:

  • If Arrived to Store is between Arrived from and Arrived to (inclusive), it returns "On Time".
  • If Arrived to Store is less than Arrived from, it returns "Early".
  • If Arrived to Store is greater than Arrived to, it returns "Late".

 

You could try to add a Custom Column with the following formula:

 

= if [Arrived to Store] >= [Arrived from] and [Arrived to Store] <= [Arrived to] then "On Time"
  else if [Arrived to Store] < [Arrived from] then "Early"
  else "Late"

 

 

 

Hope this helps!!

If this solved your problem, please accept it as a solution and a kudos!!

 

Best Regards,
Shahariar Hafiz

View solution in original post

2 REPLIES 2
shafiz_p
Super User
Super User

Hi @ranz_vincent  You said, "time_arrived_to_store" should be within "Sheet1.DRY - Arrival Time From" and "Sheet1.DRY - Arrival Time To" meaning boundary, so you need to use AND condition but you have used OR. So any condition which is true will return result and discarded other condition.

Your mentioned specific case, 6 am comes before 4 or 10 pm, and in both the condition your return result is on time. So, arrived time to store is less than 10 PM , condition 2 is true and returned "On Time", and it discarded other condition.

 

This formula works as follows:

  • If Arrived to Store is between Arrived from and Arrived to (inclusive), it returns "On Time".
  • If Arrived to Store is less than Arrived from, it returns "Early".
  • If Arrived to Store is greater than Arrived to, it returns "Late".

 

You could try to add a Custom Column with the following formula:

 

= if [Arrived to Store] >= [Arrived from] and [Arrived to Store] <= [Arrived to] then "On Time"
  else if [Arrived to Store] < [Arrived from] then "Early"
  else "Late"

 

 

 

Hope this helps!!

If this solved your problem, please accept it as a solution and a kudos!!

 

Best Regards,
Shahariar Hafiz

danextian
Super User
Super User

Hi @ranz_vincent 
As always, please post a workable sample data and your expected result from that.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.