cancel
Showing results for
Did you mean:
Helper I

## Inbound /Outbound Date difference calculation

Hi,

Could  you please help me to achieve the below scenario. it would be great if you could help on this Scenario.

Scenario: I need date difference between Inbound Created and Outbound Created date difference.

 CASE ID Created on Direction Expected Date (Date Difference between First Inbound Created date should be update in first Outbound ) 101 01-08-2022 11:30:00 Inbound 101 01-08-2022 11:00:00 Outbound 101 01-08-2022 9:40:00 Outbound 01-08-2022 9:30:00 101 01-08-2022 9:30:00 Inbound 101 01-08-2022 10:20:00 Outbound 01-08-2022 8:00:00 101 01-08-2022 9:30:00 Inbound 101 01-08-2022 8:00:00 Inbound 101 01-08-2022 7:20:00 Outbound 101 01-08-2022 6:30:00 Outbound 101 01-08-2022 6:00:00 Outbound 101 01-08-2022 6:00:00 Outbound 102 02-05-2022 6:00:00 Outbound 02-05-2022 4:55:00 102 02-05-2022 4:55:00 Inbound 102 02-05-2022 3:40:00 Outbound 02-05-2022 2:00:00 102 02-05-2022 2:00:00 Inbound 103 02-05-2022 6:00:00 Outbound 104 02-05-2022 6:00:00 Inbound

1 ACCEPTED SOLUTION
Responsive Resident

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

19 REPLIES 19
Responsive Resident

My apologies.  My attempts so far have been unsuccessful.  Additionally, I have not had much time to continue investigation, and will have no bandwidth over the next couple weeks.

If someone else is able to provide a solution in the interim, then please do so.  Otherwise, it might be some time before I can take this up again.

Regards,

Nathan

Responsive Resident

Hello @karthickpbi -

- The new dataset you provided on Saturday (Case ID's: 101 & 1023) is significantly different from the original dataset provided (Case ID's: 101, 102, 103, 104).  Since there are new requirements based on the new columns in the new dataset, I am abandoning the original datset in favor of the new one.

- For readability (and for easier column reference in DAX), I have shortened and/or renamed columns as follows:

- "To Recipients" => "Recipient"

- "Sender Email domain" => "Sender Domain"

- "Torecipient email domain" => "Recipient Domain"

- "Inbound Internal or External" => "Inbound Type"

- "Outbound Internal or External" => "Outbound Type"

- "Internal Email / External Email" => "Process"

- Regarding your post with 6 points, I want to make sure I'm understanding correctly.

1. We want to:

- Exclude WHERE [Process] LIKE '%Internal%' (NOT highlighted below)
- Include WHERE [Process] IN ('External Received', 'External Handled')

- (highlighted yellow below)
- Result: We only keep Gmail.com / Dell.com conversation

- dell to gmail (highlighted orange)

- gmail to dell (highlighted blue)

- FINAL RESULT: We only keep the rows marked in green!

- Keep only Lines: 3, 6, 7, 9, 13-17

- Exclude all other lines.

- Lines 18, 27-29 have [Process] LIKE '%External%'.   However, they are EXCLUDED because the conversation is NOT between dell.com & gmail.com.

- Am I understanding everything correctly so far?  Please make any corrections.

2. "INBOUND : Will always send from chandra@gmail.com to xjdkdirfmff@dell.com(Dell.com)"

- I don't see either of these email addresses in the new dataset.

- So perhaps this is another way of saying the conversation is between

@gmail.com & @dell.com?  But this is already stated in Point #1.

- So I'm ignoring Point #2.

- Correct me if I'm misunderstanding.

3. "Outbound : will always send from xjdkdirfmff@dell.com(Dell.com) to chandra@gmail.com."

- I'm ignoring Point #3 for the same reason as Point #2.

- Correct me if I'm misunderstanding.

4."Note: In Inbound 90% will always Inbound sender Outbound of torecipient is same customer only (External(Gmail.com))"

- My apologies.  I'm not sure what this means.

- Are you simply saying that 90% of the time, the Sender Domain for external emails will be @gmail.com?

- There is no filter criteria for this point, correct?  It's just an FYI, right?

5. "Inbound = customer sending (Sender)email to agent (to receipient)"

- There is no filter criteria for this point, correct?  It's just an FYI, right?

6 Outbound = agent sending (sender) email to customer sending (to receipient)

- There is no filter criteria for this point, correct?  It's just an FYI, right?

Again, please make any corrections to my understanding of new requirements, as needed.

Regards,

Nathan

Helper I

You are correct.

conversation between 2 domains.

- we need to apply filter and exclude Internal convrsation bcz we are showing i the Report but Not considering the Date difference. we need to consider only for External Conversation.

Here We need to calculate date is.

EX:

we need to apply sort on created on and each case we have Multiple conversation right.

Each Inbound and outboud conversation , need to consider first Inbound and First outbound and then after that any outbound will notbe consider until net inbound.

again we have received one or More inbound.. after outbound , we need to consider first Inbound an dFirst Outbound, Like FIFO

Responsive Resident

My apologies.  I have another priority I need to attend to today.  I will return to this tomorrow.

Regards,

Nathan

Helper I

Hi @WinterMist ,

I need your help further on this

Responsive Resident

Thanks for your response.  It's a relief to know there should be no duplicates!

So can you tell me exactly which Line #'s should be changed from AM to PM?

I will update my test data in the following screenshot accordingly.

Regards,

Nathan

Helper I

Helper I

Helper I

1. Here conversation between, Interl(Dell.com) and External(Gmail.com)/ Interl(Dell.com) and Interl(Dell.com). in this Case Inbound and outbound will not be consider conversation between with in Internal (DELL), so we need to Exclude Internal Conversation, Here i have Included Column Internal email/Excernal Email. filter Only External Received and External Handled. so that we will get only (Gmail.com)/ Interl(Dell.com) Conversation.

2. INBOUND : Will always send from chandra@gmail.com to xjdkdirfmff@dell.com(Dell.com)

3. Outbound : will always send from xjdkdirfmff@dell.com(Dell.com) to chandra@gmail.com.

4.Note: In  Inbound 90% will always Inbound  sender Outbound of torecipient is same customer only (External(Gmail.com))

5. Inbound = customer sending (Sender)email to agent (to receipient)

6 Outbound =   agent sending  (sender) email to customer sending (to receipient)

Helper I

We need to follw same which you send earlier Screenshot for friday -screenshot , Highlited with Blue,yellow,... N/a

Responsive Resident

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

Helper I

Thanks you @WinterMist

This is Not duplicate date its sequence date , while updating the date i have entered same date(typo mistake ).

Please reffer the data which i posted if needed. 08-06-2022 01:13 PM

Helper I

Hi @WinterMist ,

There is No Duplicate Date in the Scenario screenshot, type Mistake i have updated date. Ex(1/8/2022 9:00:00 ), here i forget to update AM and PM .and In Case 101, date start with Am to PM and We don;t have any duplicate data in the Report. we alrays map first Inbound with Forst Outbound for each Transaction.

1 One Inbound and 3 Outbound, we need to consider first Inbound date and First Outbound Date.

Date We use Desc order and Latest Record will always come top for each and Every Cases.

Thanks

Helper I

solution is Very helpfulI, but need to understand fewthing Here, it would be greate, if you can connect.

Thanks,

Responsive Resident

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

Helper I

HI @WinterMist ,

Thank you for help me on this,

Final Table  is Correct..

Note: always

Helper I

we need to connect always first inbound with First outboundbased on case,

Example: one inbound after that 2 outbound , in this case we need to map with first inbound and first outbound.

-if we have one inbound and one outbound, we can map directly.

_ Case start with Outbound ,in this case will not be consider this,

- if we have inbound after that no Outbound , this will not be consider.

- if we have 3 inbounds continuously after that 2 outboud or one outbound or 3 outbound. will always map with fitst inbound and first outbound.

Helper I

Hi @WinterMist,

Thanks for checking my request.

1. we need to map first inbound and First Out.

In Case No 101 and Line No 8,9,10,11 or Outbound before that No inbound for particular case ID  , hence will not be consider.

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. so  need to map with 6 to 7.

3. Case 101, line no 4 we have one inbound and 3 have one outbound , so we need to map 4 and 3.

4. case 101, line 2 is outbound and 1 is Inbound after one No outbound and No record so will will not be consider.

5. Case 102, we have one Inbound and outbound, one inbound and one outbound , we need to map first inbiund and first outbound.

6. Case 103 - have one outbound , will not be consider

7. case 104 we have one inbound after thant we  don't have outbound for particular case so ,will not be consider.

I Hope this clear your query.

Thank you.

Responsive Resident

Sorry.  It's not clear to me which Inbound row matches which Outbound row.

- There are multiple Inbound rows on the same date.  (1/8 & 2/5)

- There are multiple Outbound rows on the same date.  (1/8 & 2/5)

How do I correctly identify the pairs of dates which go together?

Regards,

Nathan

Announcements

#### 2023 Release Wave 1 Plans

Power BI release plans for 2023 release wave 1 describes all new features releasing from April 2023 through September 2023.

#### Ted's Dev Camp - January 26, 2023

This session will provide guidance and teach campers the skills required to build Power BI reports that support multiple languages.

#### Global Power BI Training

Make sure you register today for the Power BI Summit 2023. Don't miss all of the great sessions and speakers!

#### 2022 Monthly Feature Releases

We had a great 2022 with a ton of feature releases to help you drive a data culture.

Top Solution Authors
Top Kudoed Authors