Important Community update: The process for changing your account details was updated on June 25th. Learn how this impacts your Community experience and the actions we suggest you take to secure your account here.

Alteryx Designer Desktop Discussions

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

How do I count specific days within a range?

ArmandoGuerra
6 - Meteoroid

I'm trying to figure out how to count a list of holidays in a date range. So I have a date range of 2022-01-14 (start date in one column) to 2022-03-01 (end date in another column). If i have a list of holidays like below in  I want a count of how many times one of those dates falls within the range. So in this example I would have an output of 2 from 2022-01-14 to 2022-03-01 because 2 holiday dates fall within that range.

 

HOLIDAY_DT
1. 2022-01-17 00:00:00
2. 2022-02-21 00:00:00
3. 2022-05-30 00:00:00
4. 2022-06-20 00:00:00
5. 2022-07-04 00:00:00
6. 2022-09-05 00:00:00
7. 2022-11-11 00:00:00
8. 2022-11-24 00:00:00

4 REPLIES 4
Luke_C
17 - Castor

Hi @ArmandoGuerra 

 

I would suggest:

  1. Append the holidays to the ranges
  2. Filter on holidays that fall between the ranges
  3. Summarize/count the matches

Luke_C_0-1651866798919.png

 

ChrisTX
15 - Aurora

Use the Generate Rows tool.  See attached workflow.

 

ChrisTX_0-1651866781547.png

 

 

Chris

rfoster7
9 - Comet

There's a lot of ways to do this: There is an advanced join non-standard tool you can use. Or you can generate rows to generate one row per day between your start and end date, then do a join and then recondense it. Or you can just do the equivalent of a cartegian join with the holiday table and then a filter followed by a group by to recondense it. Probably the generate rows tool is the prettiest, so I'll show you that one. 

 

image.png

ArmandoGuerra
6 - Meteoroid

Thank you all for the solutions! @Luke_C thank for the quick solve

Labels