Hey, All!
I've been playing around with alteryx for a few months now and have read some books+watched a decent amount of tutorials, but sometimes as you all know this doesn't prepare you for everything.
Without sharing a dummy file (and I can if absolutely needed, it would just take a bit to recreate whats needed), I need a date formula that can do the following:
I have 6 columns of data joined between two data sources, and my join seems to bring in the appropriate employees given my filters etc.
Employee ID, Name, # Of Weeks, Week-End-Date, Pay_end_Dt, PTO HOURs
I need a formula that will look at each row and check the [Week-End-Date] and use this as the base to start with. Using [Week-End-Date] we need to sum the total number of [PTO Hours] going back the [# Of weeks] listed and also taking into consideration [Pay_End_Dt].
For example-
Employee 1 has as [week end date] of 2024-01-27, a [# of weeks] of 2, and several random [Pay_end_dt] weeks worth of data. He also has [PTO hours] as well for those random weeks.
Depending on his [week-end-date] will determine where this formula starts, and if his [# of weeks] is 2, then we need to sum up the [PTO hours] starting with 2024-01-27 [Week-end-date] and going back one week....The caveat here is that it matters what [Pay_end_dt]s are available. So if the Employee only has say 2024-01-27 [Pay-end-dt] data then you would only calc that week, if he has a [pay-end-dt] of 2024-01-27 and also 2024-01-20, you would sum up those two weeks worth of [PTO hours].
If the employee has NO [Pay_end_dt]s that are within the [# of weeks] from the [Week-end-date], it would just return 0 regardless of how many PTO hours he has we only care about the # of weeks from the week end date, and the weeks ONLY lining up with Pay end dates to get the sum.
Any help or guidance with this would be greatly appreciated.
@ewalt91 I think a dummy data set would be extremely helpful - this post has ~20+ views without a solution provided, which is rare. Also, please include a screenshot of what you expect the output to look like once the workflow has completed.
Conceptually, I think this could be a pretty easy workflow to set up for you. I would transpose the data based on some unique primary key (e.g. Employee ID). Then, from there, we can inject relevant date variables (Week-End Date, Pay_End_Dt, etc.) to test whether certain rows match the conditions you are needing to test. Afterwards, we would set up a Multi-Row formula tool to handle the row-level calculations you need.
I will work on a dummy data set very soon and post it here as a response. Thanks!
Dummy set + snip of the end result is attached. I will then take this further and do some calcs on it to get to my workflow conclusion. I believe this is be my only issue at the moment.
The bottom join is the one that's causing issues. The data within the inner join is correct, but doing the formula on that is proven to be trivial.
Greatly appreciate the guidance.
Hi @ewalt91,
You need to include the input files in your dummy data. If you export the workflow (under options) you can include the input files.
Regards,
Ben