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.
Hi,
I've got a few DateTime columns:
For the time differences between them e.g. time between Job Booking to Attempted Accepted, time between Job Booking to Acceptance; I need to categorize these time differences into the following time intervals:
Here is sample data
Hope that made sense. Appreciate any help.
Solved! Go to Solution.
Hi @Anonymous ,
If (WEEKDAY(Date, 2) = 6 || WEEKDAY(Date,2) = 7, “”,The formula applied above)
If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel
Proud to be a Super User!
Hi @Anonymous
You can try to add two columns like below.
Acceptance = IF( NOT ISBLANK( 'Table'[ACCEPTANCE_DATETIME] ), VAR _hrs = HOUR( 'Table'[ACCEPTANCE_DATETIME] - 'Table'[JOB_BOOKING_DATETIME] ) RETURN SWITCH( TRUE(), _hrs >= 0 && _hrs <= 2, "0-2hrs", _hrs >= 3 && _hrs <= 4, "3-4hrs", _hrs >= 5 && _hrs <= 12, "5-12hrs", _hrs >= 13 && _hrs <= 24, "13-24hrs", ">24hrs" ) )
Attempted = IF( NOT ISBLANK( 'Table'[ATTEMPTED_ACCEPTANCE_DATETIME] ), VAR _hrs = HOUR( 'Table'[ATTEMPTED_ACCEPTANCE_DATETIME] - 'Table'[JOB_BOOKING_DATETIME] ) RETURN SWITCH( TRUE(), _hrs >= 0 && _hrs <= 2, "0-2hrs", _hrs >= 3 && _hrs <= 4, "3-4hrs", _hrs >= 5 && _hrs <= 12, "5-12hrs", _hrs >= 13 && _hrs <= 24, "13-24hrs", ">24hrs" ) )
@Mariusz thank you for quick response. I notice the two column functions are exactly the same or am I missing something?
Or did you mean one column for Acceptance datetime and the other for Attempted Acceptance datetime?
Hi @Mariusz how do I exclude weekends (Sat & Sun) from this function?
i.e. if Job_Booking_DateTime is on Sat or Sun, then exclude from calculation
Hi @Anonymous ,
If (WEEKDAY(Date, 2) = 6 || WEEKDAY(Date,2) = 7, “”,The formula applied above)
If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel
Proud to be a Super User!
Thank you @Nathaniel_C , just wasn't sure where to wrap that formula in the current function. Thanks for clarifying, appreciate it.
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 |
---|---|
47 | |
24 | |
20 | |
15 | |
13 |
User | Count |
---|---|
55 | |
48 | |
43 | |
19 | |
19 |