Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Look back dynamically

Yuri24
8 - Asteroid

Hello,

 

I am trying to calculate rate based of product site visits and products purchased which will be products purchased in that last 15 days over product site visits for the same time frame. However, the 15day look back timeframe should be dynamic for any date selected.

 

I wrote a condition to filter the data which is [SiteVisitDate]>=DatetimeAdd(tDateTimeToday(),-15,"days") and [SiteVisitDate]<=DateTimeToday() but this seem to capture or filter data for today only- and when I link the output to a dashboard and select a date from drop down this is not pulling data correctly.as it has data limited to last 15 days. So when I select yesterday's day I am not showing full data.

 

Is this possible to do this dynamically for any date?

 

Sample data

 

SiteVisitPurchasedSiteVisitDate
1002/17/2023
1009/16/2022
1005/24/2023
1009/06/2022
1008/26/2020
1101/03/2023
1108/01/2023
1006/23/2023
1009/11/2023
1104/20/2023
1005/09/2023
1007/28/2023
1011/15/2022
1111/08/2022
1008/05/2023
1005/04/2022
1010/21/2022
1011/17/2022
1007/06/2021
1010/03/2022
1009/21/2022

 

4 REPLIES 4
Peachyco
11 - Bolide

This is kinda a simplistic, brute-force approach, but this can be done with the Multi-Row Formula Tool by looking through the previous records and checking if they're within 15 days of the current record, summing the numbers along the way:

Alteryx screenshot.png

PangHC
13 - Pulsar

@Yuri24 wrote:
...

when I link the output to a dashboard and select a date from drop down

...

 


you should do the filtering in the dashboard site, as the data size is reduced. if not, each line have to duplicate as much as the dropdown options to fulfil the requirement.

@Yuri24 wrote:
...

However, the 15day look back timeframe should be dynamic for any date selected.

...

 


if you refer to dynamic, you can try to use app function.

or the interface.

 

change the formula to this any date also can. It just easy for change later.

Screenshot 2023-09-26 144052.png

 

add Date and action tool as follow. (both in interface section)

 

Screenshot 2023-09-26 144047.png

how to use it:

beside the run button it will have a magic wand. press that to process.

Screenshot 2023-09-26 144236.png

 

and, here the lessons if you interested.
Interactive Lessons - Alteryx Community

 

 

Yuri24
8 - Asteroid

Thanks but looks like it wont work well for same dates or duplicate dates

Yuri24
8 - Asteroid

Thanks, but the date if I use interaction seeks for manual entry. If I publish this on a server its got to be more dynamic

Labels
Top Solution Authors