Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Solved! Go to Solution.
@ahmad1111 Create a calculated column to determine if the delivery is on time or not.
dax
OTD =
VAR Priority = 'Table1'[Priority]
VAR Diff = 'Table1'[DIFF]
VAR DayPOD = 'Table1'[DAYPOD]
VAR IsWeekend = IF(DayPOD = "Saturday" || DayPOD = "Sunday", 1, 0)
VAR AdjustedDiff =
IF(Priority <= 3,
Diff - COUNTROWS(
FILTER(
CALENDAR('Table1'[OrderDate], 'Table1'[EventDate]),
WEEKDAY([Date], 2) > 5
)
),
Diff
)
RETURN
IF(
(Priority <= 3 && AdjustedDiff <= 5) ||
(Priority >= 4 && Diff <= 1),
"OnTime",
"NotOnTime"
)
Proud to be a Super User! |
|
Hi @ahmad1111 ,
Based on the information, try using the following DAX formula.
OTD =
VAR Priority = 'Table1'[Priority]
VAR DayPOD = 'Table1'[DAYPOD]
VAR Diff = 'Table1'[DIFF]
VAR IsWeekend = (DayPOD = "Saturday" || DayPOD = "Sunday")
VAR OnTimeCondition =
SWITCH(
TRUE(),
Priority <= 3 && Diff <= 5 && !IsWeekend, "OnTime",
Priority > 3 && Diff <= 1, "OnTime",
TRUE, "NotOnTime"
)
RETURN OnTimeCondition
If the DAX formula is wrong or doesn't work, please provide example data.
Best Regards,
Wisdom Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@ahmad1111 Create a calculated column to determine if the delivery is on time or not.
dax
OTD =
VAR Priority = 'Table1'[Priority]
VAR Diff = 'Table1'[DIFF]
VAR DayPOD = 'Table1'[DAYPOD]
VAR IsWeekend = IF(DayPOD = "Saturday" || DayPOD = "Sunday", 1, 0)
VAR AdjustedDiff =
IF(Priority <= 3,
Diff - COUNTROWS(
FILTER(
CALENDAR('Table1'[OrderDate], 'Table1'[EventDate]),
WEEKDAY([Date], 2) > 5
)
),
Diff
)
RETURN
IF(
(Priority <= 3 && AdjustedDiff <= 5) ||
(Priority >= 4 && Diff <= 1),
"OnTime",
"NotOnTime"
)
Proud to be a Super User! |
|
Got error
@ahmad1111 , Check dates mentioned inside calender formular, Start date is after end date
Proud to be a Super User! |
|
my dates i am testing with currently is as follows Created On is the Order Date and Timestamp is eventdate note that is my data source this from excel
Created On | Timestamp |
01/06/25 | 01/07/25 |
01/06/25 | 01/07/25 |
01/06/25 | 01/07/25 |
01/06/25 | 01/07/25 |
01/06/25 | 01/07/25 |
01/06/25 | 01/07/25 |
01/06/25 | 01/07/25 |
01/06/25 | 01/07/25 |
01/19/25 | 01/21/25 |
01/19/25 | 01/21/25 |
01/19/25 | 01/21/25 |
01/19/25 | 01/21/25 |
01/19/25 | 01/21/25 |
01/19/25 | 01/21/25 |
01/19/25 | 01/21/25 |
01/19/25 | 01/21/25 |
01/19/25 | 01/21/25 |
01/19/25 | 01/21/25 |
01/19/25 | 01/21/25 |
01/19/25 | 01/21/25 |
01/19/25 | 01/21/25 |
01/19/25 | 01/21/25 |
01/19/25 | 01/21/25 |
01/19/25 | 01/21/25 |
01/19/25 | 01/21/25 |
01/19/25 | 01/21/25 |
01/19/25 | 01/21/25 |
01/19/25 | 01/21/25 |
01/19/25 | 01/21/25 |
01/06/25 | 01/07/25 |
01/06/25 | 01/07/25 |
01/06/25 | 01/07/25 |
01/06/25 | 01/07/25 |
01/06/25 | 01/07/25 |
01/06/25 | 01/07/25 |
01/06/25 | 01/07/25 |
01/06/25 | 01/07/25 |
01/06/25 | 01/07/25 |
01/06/25 | 01/07/25 |
01/06/25 | 01/07/25 |
01/06/25 | 01/07/25 |
01/06/25 | 01/07/25 |
01/06/25 | 01/07/25 |
01/06/25 | 01/07/25 |
01/06/25 | 01/07/25 |
01/06/25 | 01/07/25 |
01/06/25 | 01/07/25 |
01/06/25 | 01/07/25 |
01/06/25 | 01/07/25 |
01/06/25 | 01/07/25 |
01/06/25 | 01/07/25 |
01/06/25 | 01/07/25 |
01/06/25 | 01/07/25 |
01/06/25 | 01/07/25 |
01/06/25 | 01/07/25 |
01/06/25 | 01/07/25 |
01/06/25 | 01/07/25 |
01/06/25 | 01/07/25 |
01/06/25 | 01/07/25 |
01/06/25 | 01/07/25 |
01/06/25 | 01/07/25 |
01/06/25 | 01/07/25 |
01/06/25 | 01/07/25 |
01/06/25 | 01/07/25 |
01/06/25 | 01/07/25 |
01/06/25 | 01/07/25 |
01/06/25 | 01/07/25 |
01/06/25 | 01/07/25 |
01/06/25 | 01/07/25 |
01/06/25 | 01/07/25 |
01/06/25 | 01/07/25 |
01/06/25 | 01/07/25 |
01/06/25 | 01/07/25 |
01/06/25 | 01/07/25 |
01/06/25 | 01/07/25 |
01/06/25 | 01/07/25 |
01/06/25 | 01/07/25 |
01/06/25 | 01/07/25 |
01/06/25 | 01/07/25 |
01/06/25 | 01/07/25 |
01/06/25 | 01/07/25 |
01/06/25 | 01/07/25 |
01/05/25 | 01/09/25 |
01/03/25 | 01/03/25 |
01/05/25 | 01/09/25 |
01/21/25 | 01/22/25 |
01/16/25 | 01/17/25 |
01/06/25 | 01/07/25 |
01/19/25 | 01/22/25 |
01/16/25 | 01/21/25 |
hi bhanu i checked it should be correct but weird thing is if i change OrderDate which i dont want to but i tested and made it date 01.01.2025 manual instead of OrderDate error goes away but i want to keep that orderdate see in my excel sheet if i make it same as today date or close to it it gives that same error again is there a work around this?
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
10 | |
9 | |
8 | |
7 | |
6 |
User | Count |
---|---|
14 | |
13 | |
11 | |
9 | |
8 |