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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.