Hey Alteryx Community,
I'm diving into the world of Alteryx, and I could really use some advice from the experts!
I'm coming from an SQL background and I've cracked a case using SQL, but now I'm all ears to learn how to do the same thing in Alteryx.
To provide some context, I have successfully solved a specific case using SQL, but now I'm eager to replicate the same logic within Alteryx.
The goal of the case is to create an inventory overview that dynamically reflects the availability of products based on demand deadlines.
This is what I've been cooking up in SQL:
with base as (
SELECT
material_number,
demand_deadline,
MIN(demand_deadline) OVER (PARTITION BY material_number) AS min_start_date,
MAX(demand_deadline) OVER (PARTITION BY material_number) AS max_end_date,
LEAD(demand_deadline) OVER (PARTITION BY material_number ORDER BY demand_deadline) AS next_demand_deadline,
SUM(demand_qqt) OVER (PARTITION BY material_number ORDER BY demand_deadline ASC) AS acc_demand_qqt
FROM `stg_demand`
),
daterange AS(
SELECT DISTINCT
b.material_number,
day
FROM base AS B
CROSS JOIN UNNEST(GENERATE_DATE_ARRAY( B.min_start_date, B.max_end_date , INTERVAL 1 DAY)) AS day
)
SELECT
D.day,
d.material_number,
SUM(acc_demand_qqt) as acc_demand
FROM daterange AS D
INNER JOIN base AS B
ON D.day >= B.demand_deadline
AND (D.day < B.next_demand_deadline OR next_demand_deadline IS NULL)
AND D.material_number = B.material_number
group by 1,2
order by dayI'm hoping you can show me the ropes. How do I take this SQL logic and turn it into an Alteryx workflow?
I'm especially curious about things like generating date ranges and mimicking window functions like LEAD.
If you could share any tips, tricks, or even a step-by-step example, I'd be over the moon! ✨
Thanks a million in advance for your help! Looking forward to soaking up your wisdom! 💡
Cheers