Missed the Q4 Fall Release Product Update? Watch the on-demand webinar for more info on the latest in Designer 24.2, Auto Insights Magic Reports, and more!
Free Trial

Alteryx Designer Desktop Discussions

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

Dynamic Subtraction

akumar2609
8 - Asteroid

Hi All,

 

I have a workflow which always populates the data into a new tab (with date and time mentioned on it) when ever we run it. My requirement is to get the difference between the 'current run' data and the last run data. 

 

For example - if I ran the data (let's call it as A) now and the last time workflow was run 2 hours ago( let's call it as B), the result, I need is B-A in subtract column. 

This work totally fine, until we move to a new month end cycle, as in the new month, there will  be no previous data available. Before rolling forward for the next month, we delete all the tabs from the previous cycle. 

 

Is there any way that when I run the data for the first time in the new month end cycle, it should give me the result as it is the data available for the first day?  

3 REPLIES 3
rzdodson
12 - Quasar

@akumar2609I may be able to help you here. Are you saving unique instances of the file, or saving over the original output from the workflow once the workflow completes its run? It'll influence the tools likely used in a solution for you. 

akumar2609
8 - Asteroid

My Output file will remain same. The only change which will happen here is creating a new tab for the output with date and time as the tab name, all the time when we run the workflow. 

rzdodson
12 - Quasar

@akumar2609 this should be able to help you out. Basically what I am doing here is grabbing the file you are overwriting and retrieving its LastWriteTime field using a directory tool. Once gathered, it'll be appended to the data set from the rest of your workflow. Then, I create some helper variables to calculate the difference in minutes and days between the runs, create a dynamic output path string to save the output where the workflow is saved, before outputting.

 

Since it sounds like you know the exact file you are looking for, I would include that as an additional filter condition in the Filter tool in the second layer.

01. Solution.png

 

Edit: since it sounds like you already know the file name you are saving over, you can also delete the Select through RecordID tools in between the Directory and Filter tool in the second layer as well.

 

 

Labels
Top Solution Authors