We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Summarize last 90 days of history for the end of each month

memphis_data
6 - Meteoroid

I have a file of millions of transactions that goes back many years. At the end of each month, I'd like to get a unique list of users that used the product within the last 90 days.  I'm doing this very manually right now by entering all of the conditions into a formula, but it feels very inefficient, and if the dataset was smaller it would be much easier to do in SQL.

 

transaction_tsuser_id
2024-01-01 00:04:34123456
2024-01-11 00:04:34987654
2024-02-03 00:04:34666666
2024-02-07 00:04:34123456
2024-03-01 00:04:34777777
2024-04-01 00:04:34666666
2024-04-12 00:04:34123456
2024-05-01 00:04:34987654
2024-06-01 00:04:34777777
2024-06-16 00:04:34777777
2024-07-03 00:04:34123456
2024-08-07 00:04:34987654
2024-09-04 00:04:34444444
2024-09-11 00:04:34777777
2024-10-02 00:04:34777777
2024-10-15 00:04:34987654

 

I would like to get the result that looks like the following without having to manual

Start DateEnd DateUnique User Count
12/31/20233/31/20244
1/30/20224/30/20243
3/2/20225/31/20243
4/1/20226/30/20244
5/2/20227/31/20242
6/2/20228/31/20243
7/2/20229/30/20244
8/2/202210/31/20243
2 REPLIES 2
binuacs
21 - Polaris

@memphis_data How do you derive the start date and the end date? also the difference between 1/30/2022 and 4/30/2024 is more than 90 days

GrowthNatives
8 - Asteroid
 

Hi @memphis_data,
I see you're running into an issue to summarize last 90 days of history for the end of each month

 

Steps I took in Alteryx:
1. Input Data

  • Use an Input Data tool with columns:

    • transaction_ts (timestamp)

    • user_id

2. Create Month-End Dates Dynamically

Use a Summarize tool:

  • Group by: transaction_ts

  • Then:

    • Take Min and Max of transaction_ts

Then use a Generate Rows tool: (as in picture)

Screenshot_2.png

 

Start: DateTimeTrim([Start_Date], "month")
Condition: [CurrentDate] <= DateTimeTrim([End_Date], "month")
Loop Expression: DateTimeAdd([CurrentDate], 1, "months")
Create: [CurrentDate]

Then add a Formula Tool:

      MonthEnd = DateTimeAdd(DateTimeTrim([CurrentDate], "month"), 1, "months")
  MonthEnd = DateTimeAdd([MonthEnd], -1, "days")

Now you have all month-end dates dynamically.

 

3. Append Month-End to Transactions

  • Use an Append Fields tool:

    • Append each transaction with each End_Date

4. Filter for 90-Day Windows

Add a Filter tool:

[transaction_ts] <= [End_Date] AND
[transaction_ts] >= DateTimeAdd([End_Date], -90, "days")


5. Get Unique User Count

Use a Summarize tool:

  • Group by: End_Date, user_id → to get distinct users per month

  • Then again group by: End_Date and count user_id


6. Add Start Date

Add a Formula Tool to calculate:

Start_Date = DateTimeAdd([End_Date],-90,"day")


7. Optional: Sort by End_Date 

Final Result:

Screenshot_1.png

This is fully dynamic, scales with data, and you never need to update anything manually again.

Please find the workflow attached below.


Hope this solution helps you make the most of Alteryx! If it did, click 'Mark as Solution' to help others find the right answers.

💡Found it helpful? Show some love with kudos 👍 as your support keeps our community thriving!

🚀Let’s keep building smarter, data-driven solutions together! 🚀

 

 

 

Labels
Top Solution Authors