Forum Discussion
Checking Time Values
- 6 years ago
Hi andersona1983,
Feel like I am a little late to the party, but given your data I think the following will provide the 'Prev' columns you need
andersona1983 - Ammended to include overlap column and removed formatting as the comparison needs to compare the actual dates and not just the time strings. You can format the columns in another column if requiredPrev End Time = var client = [Client Name] var index = [Index] return CALCULATE(MIN('Table'[Appointment End Datetime]), FILTER(ALL('Table'), 'Table'[Client Name] = client && 'Table'[Index] = index -1)) Prev Start Time = var client = [Client Name] var index = [Index] return (CALCULATE(MIN('Table'[Appointment Start Datetime]), FILTER(ALL('Table'), 'Table'[Client Name] = client && 'Table'[Index] = index -1))) Overlap = if( 'Table'[Appointment Start Datetime]< 'Table'[Prev End Time] || 'Table'[Appointment Start Datetime] = 'Table'[Prev End Time], "Overlap" , "")Hope this Helps,
Richard
Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!
Hello Greg_Deckler
Thanks for the reply. You had recommended a ticketting system, but the system didn't work very well.
My problem is a patient can have multiple appointments in a day. Some of our clinical staff do not use the correct codes, and we are needing to isolate these codes. Our software, unless we are looking at every patient, does not locate these codes, and will bill them. As such, we need to isolate, and remove these codes from billing. The reason I have ran the Power Query to Sort, is that I need to have the data in Office, Client, Appt Date, Appt Time order so that I can see if the prior row has a later end time than start time, or if the start times are equal. If they are they are overlapping. It can literally return anything, 1, 2, Yes, No.
When comparing the data, and you have 100 patients with 5-10 appointments a day, can earliest be used by isolating the client? Newer to this, and still trying to understand the language and all. Thanks for the continued help!
andersona1983 - Let's start here, given the sample data provided, what is your expected output?
- andersona19836 years agoHelper I
My Data listed above has issues, the Appt Date is wrong. Here is the appropriate Data. My Apologies, I was trying to clear private protected info.
Client Office Name Appt. Status Staff Name Appt. Date Subject Line Appointment Start Datetime Appointment End Datetime Is Rendered Service Code Service Category Client Name CENTRAL ACTIVE Her, Joh 8/3/2020 XXXX 8/3/2020 11:00 8/3/2020 14:00 Yes DIR
A Adoe, John CENTRAL ACTIVE Gar, Tam 8/3/2020 XXXX 8/3/2020 14:00 8/3/2020 16:00 Yes DIR A Adoe, John CENTRAL ACTIVE Mar, Mar 8/3/2020 XXXX 8/3/2020 16:00 8/3/2020 18:00 Yes DIR A Adoe, John CENTRAL ACTIVE Ols, And 8/3/2020 XXXX 8/3/2020 16:30 8/3/2020 17:00 Yes DIR A Adoe, John CENTRAL ACTIVE Her, Joh 8/4/2020 XXXX 8/4/2020 11:00 8/4/2020 14:00 Yes DIR A Adoe, John CENTRAL ACTIVE Gar, Tam 8/4/2020 XXXX 8/4/2020 14:00 8/4/2020 16:00 Yes DIR A Adoe, John CENTRAL ACTIVE Mar, Mar 8/4/2020 XXXX 8/4/2020 16:00 8/4/2020 18:00 Yes DIR A Adoe, John CENTRAL ACTIVE Her, Joh 8/5/2020 XXXX 8/5/2020 11:00 8/5/2020 14:00 Yes DIR A Adoe, John CENTRAL ACTIVE Gar, Tam 8/5/2020 XXXX 8/5/2020 14:00 8/5/2020 16:00 Yes DIR A Adoe, John CENTRAL ACTIVE Mar, Mar 8/5/2020 XXXX 8/5/2020 16:00 8/5/2020 18:00 Yes DIR A Adoe, John CENTRAL ACTIVE Ols, And 8/5/2020 XXXX 8/5/2020 16:30 8/5/2020 17:00 Yes DIR A Adoe, John CENTRAL ACTIVE Her, Joh 8/6/2020 XXXX 8/6/2020 11:00 8/6/2020 14:00 Yes DIR A Adoe, John CENTRAL ACTIVE Gar, Tam 8/6/2020 XXXX 8/6/2020 14:00 8/6/2020 16:00 Yes DIR A Adoe, John CENTRAL ACTIVE Mar, Mar 8/6/2020 XXXX 8/6/2020 16:00 8/6/2020 18:00 Yes DIR A Adoe, John CENTRAL ACTIVE Ols, And 8/6/2020 XXXX 8/6/2020 16:00 8/6/2020 16:30 Yes DIR A Adoe, John To list every client with overlapping appointments.
In this list it would be:
Client Office Name Appt. Status Staff Name Appointment Start Datetime Appointment End Datetime Client Nam CENTRAL ACTIVE Ols, And 8/3/2020 16:30 8/3/2020 17:00 Adoe, John CENTRAL ACTIVE Ols, And 8/5/2020 16:30 8/5/2020 17:00 Adoe, John CENTRAL ACTIVE Ols, And 8/6/2020 16:00 8/6/2020 16:30 Adoe, John - andersona19836 years agoHelper I
This is for a single patient. My data will included multiple patients some with the same appointment times. Staff members also cross through multple clients.
- Greg_Deckler6 years agoCommunity Champion
andersona1983 - OK, so I think I understand this now. Next question, do you just want to know if an appointment overlaps with any other appointment or are you ultimately looking for a list of appointments that overalap other appointments? Trying to make sure I understand 100% what you are looking to achieve.