Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I am creating an on time shipping report that calculates whether orders, received by 3:15 pm, go out the same day or, if they come in after 3:15 pm, ship the next business day.
I have created the calculated column that does the basic math to figure out if they went out on the same day but I need to exlude weekends because all of my Friday afternoon orders are coming back as going out late even though they ship by end of day Monday, which technically means they were on time.
Solved! Go to Solution.
Hi @Jacob_Steagald ,
You can update the formula of calculated column [On Time] as below, please find the details in the attachment.
On Time =
IF (
'Shipping'[Date added] = 'Shipping'[Date shipped]
|| (
'Shipping'[Date shipped] = 'Shipping'[Date added] + 1
&& TIMEVALUE ( 'Shipping'[Time added] ) > TIME ( 15, 15, 0 )
)
|| (
WEEKDAY ( 'Shipping'[Date added], 2 ) = 5
&& TIMEVALUE ( 'Shipping'[Time added] ) > TIME ( 15, 15, 0 )
&& 'Shipping'[Date shipped] = 'Shipping'[Date added] + 3
),
"On Time"
)
Best Regards
Order Number | Date Added | Time Added | Date Shipped |
1 | Thursday, January 12, 2023 | 12:54:04 PM | Thursday, January 12, 2023 |
2 | Thursday, January 12, 2023 | 2:25:14 PM | Friday, January 13, 2023 |
3 | Thursday, January 12, 2023 | 4:04:25 PM | Friday, January 13, 2023 |
4 | Friday, January 13, 2023 | 10:14:46 AM | Friday, January 13, 2023 |
5 | Friday, January 13, 2023 | 3:01:14 PM | Friday, January 13, 2023 |
6 | Friday, January 13, 2023 | 4:45:13 PM | Monday, January 16, 2023 |
7 | Monday, January 16, 2023 | 2:11:45 PM | Monday, January 16, 2023 |
This is a sample set from our data. As you can see, Orders 1, 4, 5, and 7 all shipped out on the same day.
Order 2 should be Late as it was received BEFORE 3:15 and didn't ship out until the next day.
Order 3 should be considered On Time because it came in AFTER 3:15 and was shipped out the next day.
All of that is accounted for in my previous column.
Order 6 is really what I am focused on. That order came in on a Friday AFTER the 3:15 deadline and then shipped on the next business day, Monday. By rule that should be considered On Time. However, neither my original model nor the one supplied above accounts for them. My model marks it as late and the one you supplied simply doesn't mark it at all.
I'd appreciate any help you can offer
Hi @Jacob_Steagald ,
You can update the formula of calculated column [On Time] as below, please find the details in the attachment.
On Time =
IF (
'Shipping'[Date added] = 'Shipping'[Date shipped]
|| (
'Shipping'[Date shipped] = 'Shipping'[Date added] + 1
&& TIMEVALUE ( 'Shipping'[Time added] ) > TIME ( 15, 15, 0 )
)
|| (
WEEKDAY ( 'Shipping'[Date added], 2 ) = 5
&& TIMEVALUE ( 'Shipping'[Time added] ) > TIME ( 15, 15, 0 )
&& 'Shipping'[Date shipped] = 'Shipping'[Date added] + 3
),
"On Time"
)
Best Regards
Hi @Jacob_Steagald ,
You can update the formula of calculated column [On Time] as below and check if it can return the expected result...
On Time =
IF (
'Shipping'[Date added] = 'Shipping'[Date shipped]
|| (
'Shipping'[Date shipped] = 'Shipping'[Date added] + 1
&& TIMEVALUE ( 'Shipping'[Time added] ) > TIME ( 15, 15, 0 )
)
|| (
WEEKDAY ( 'Shipping'[Time added], 2 ) = 5
&& TIMEVALUE ( 'Shipping'[Time added] ) > TIME ( 15, 15, 0 )
&& 'Shipping'[Date shipped] = 'Shipping'[Date added] + 3
),
"On Time"
)
If the above one can't help you, please provide some raw data in the table 'Shipping' (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It would be helpful to find out the solution. You can refer the following links to share the required info:
How to provide sample data in the Power BI Forum
And It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.
How to upload PBI in Community
Best Regards
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
96 | |
92 | |
82 | |
70 | |
64 |
User | Count |
---|---|
115 | |
106 | |
96 | |
81 | |
72 |