Start Free Trial

Alteryx Designer Desktop Discussions

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

Issue with “Days Revoked After Termination” Calculation in Workflow

Celeya
6 - Meteoroid

I am working on an Alteryx workflow to replicate SQL logic for calculating Days Revoked After Termination. The logic should compute:

ALTER FUNCTION [dbo].[CalculateWorkingDays](@StartDate DATE, @EndDate DATE)
RETURNS INT
AS
BEGIN
DECLARE @TotalDays INT = DATEDIFF(day, @StartDate, @EndDate);
DECLARE @WeekendDays INT = 0;
DECLARE @CurrentDate DATE = @StartDate;
 
WHILE @CurrentDate < @EndDate
BEGIN
IF DATEPART(weekday, @CurrentDate) IN (1, 7)
BEGIN
SET @WeekendDays = @WeekendDays + 1;
END
SET @CurrentDate = DATEADD(day, 1, @CurrentDate);
END
 
RETURN @TotalDays - @WeekendDays;
END;
 
(Start Date = Termination Date
End Date = Effective Date)
 

Expected behavior:

  • If Termination Date = 2025-05-09 and Effective Date = 2025-05-10 →
    TotalDays = 1, WeekendDays = 0, Result = 1

    the workflow i have created has been attached here. Appreciate if anyone could help on this
3 REPLIES 3
binu_acs
21 - Polaris

@Celeya can you try the attached workflow

binu_acs_0-1762275798751.png

Celeya
6 - Meteoroid

if possible, can you please edit in the original workflow i shared 

binu_acs
21 - Polaris

@Celeya Can you attach the input file , it is missing in the original post

Labels
Top Solution Authors