Forum Discussion
Inbound /Outbound Date difference calculation
- 4 years ago
So I'm not finished, but am getting close.
As you will see, I really need an answer to the duplicate timestamps.
These present a significant problem.
Scenario A = CASE ID 102
1) Create the following "Order" column.
It is imperative that this column groups by both [CASE ID] & [Direction].
The purpose of this column is to label in order (from 1 to N) the lowest timestamp to the highest timestamp within each grouping of CASE ID & Direction.
NOTE: In this case, I am isolating CASE ID 102 to simplify the example.
2) Create a new table called "Inbound" as follows, including only the Inbound rows.
NOTE: I renamed column "Created On" to "Date In".
3) Create a new table called "Outbound" as follows, including only the Outbound rows.
4) In the Inbound table, create the following columns:
- Date Out
NOTE: THIS IS WHERE THE MAGIC HAPPENS! WE'RE LINKING [Date In] TO [Date Out] BASED ON [Order]!
- Difference DateDiff (in minutes)
- Difference Operator (in HH:MM:SS)
NOTES: I provided Difference in 2 different ways. Use whichever you like.
Scenario B = CASE ID 101
- As you can see in Line 10 & 11, there are 2 identical rows for CASE 101 & Direction Outbound. As a result, both rows get assigned Order #2. For this reason, no Order #1 gets created for 101 Outbound, and therefore, cannot match up correctly with Order #1 for 101 Inbound. The end result, is incorrect matching & incorrect calculations.
- There is a similar problem with Line 4 & 6. There are 2 identical rows for CASE 101 & Direction Inbound. I don't understand how Order selected Row 6 as "Order 1" & Row 4 as "Order 2". But this really doesn't matter since we don't know which one should come first anyway. So it could be right or wrong, but we have no way to know.
Finally, as you can tell, I have also not yet programmed in the rule about [Date In] needing to be LESS THAN [Date Out] for it to be valid. If you get stuck on this one, let me know and I will come back to you.
Before worrying about that though, you either need to:
1) Remove identical duplicate rows (OR)
2) Clearly specify how to handle identical duplicate rows, if they are in fact, legitimate.
Hope what I have provided so far is helpful to you!
Regards,
Nathan
Thanks for providing all this information. Very helpful.
- I now understand that we map the FIRST-IN with FIRST-OUT for a given case, provided that [FIRST-IN timestamp] < [FIRST-OUT timestamp].
- Is it also true that we map SECOND-IN with SECOND-OUT for the same case?
- And THIRD-IN with THIRD-OUT for the same case?
- And so on to infiniti within the same case?
Points 2 & 5 are a bit confusing to me.
2. Case 101, Line no 7,6, 5 - in this case 7& 6 are Inbound, so we need to
- map 7 Inbound with 5 line for Outbound. (First, you say to map 5 to 7.)
- so need to map with 6 to 7. (Then, you say to map 6 to 7. Is this a typo?)
5. Case 102, we have one Inbound and outbound, one inbound and one outbound , we need to map first inbiund and first outbound.
- I notice that no reference is made to mapping the SECOND-IN to SECOND-OUT here (within Case 102), even though it exists (and it was also done for Case 101 on lines 3 & 4). Is this intentional? For example, the FIRST pair I have labeled in the following screenshot as "Map 3". The SECOND pair I have labled as "Map 4". Should Line 12 & 13 be marked as "N/A" or a valid map pair?
One other thing confuses me as well. In Case 101, Line 4 & 6 both have an identical timestamp of 1/8/22 9:30.
So for this SECOND-IN + SECOND-OUT pairing, how do we tell DAX which line to choose for the pairing?
Finally, could you review the entire "Map" column I added for all data; checking every single row & making corrections as necessary?
Regards,
Nathan
- karthickpbi4 years agoHelper I