Start Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Counting continuous hours used

donnellya
5 - Atom

I'm looking to see how many times a provider didn't use a continuous 4 hour stretch of time. In the example below Andrew didn't had 8 available hours but didn't use the last 4 so he used 1 session. Bob had 8 hours too but never went 4 continuous hours without seeing a patient.

 

I used a cross tab tool to get the data in the format below. Data is on vertical axis by provider, date, hour, and patients seen. Thought this would be easier.

 

I was trying to use a multi row formula but I'm stuck. Any guidance? 

 

ProviderDate89101112131415Session
Andrew1/19/2021111100001
Bob1/19/2021111011102
2 REPLIES 2
MarqueeCrew
20 - Arcturus
20 - Arcturus

@donnellya ,

 

I'm attaching a workflow that sorts your data (vertical) by PERSON, DATE and Sequential Hour.  It looks behind for the last 3 hours to see if they are all 0 (including current hour).  If so, it sets a value of 1 to a new 4hour flag.  It spans days to see if the string gets broken or continued.  Here's the multi-row formula that I used (setting Num Rows to 3):

 

IIF(
[Usage] = 0       AND [Row-1:Usage] = 0 AND 
[Row-2:Usage] = 0 AND [Row-3:Usage] = 0
,1,0)

 

Cheers,

 

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and restart. Order shall return.
Please Subscribe to my youTube channel.
donnellya
5 - Atom

Thank you!

 

I made one update. I added a similar multi row formula after the other so I could count 4 hour blocks of time as 1. Image with example of why this is necessary below. 

 

Second multi row code:

 

IIF(
[Used In Person Slots] = 0
AND
[Row-1:4 hr flag] = 0
AND
[Row-1:Used In Person Slots] = 0
AND
[Row-2:4 hr flag] = 0
AND
[Row-2:Used In Person Slots] = 0
AND
[Row-3:4 hr flag] = 0
AND
[Row-3:Used In Person Slots] = 0
,1,0)

Labels
Top Solution Authors