Question
If each record has an open and close date, how to display active records over timeFor example, using the attached data set containing start/end dates for each client, how many clients were active on August 4, 2021?
Starting in Tableau Prep Builder 2021.3.1, you can create a step to add rows for every day (or other date level) between the start and end date. See Fill Gaps in Sequential Data for instructions.
In Tableau Prep Builder
In Tableau Desktop
DATETRUNC('week',WINDOW_MIN(MIN([Date])))
DATEADD('week',(INDEX() - 1),[Start Date])
IF [Running Date] >= WINDOW_MAX(MAX([Date]))
AND [Running Date] <= WINDOW_MAX(MAX([Closed Date]))
THEN 1
ELSE 0
END
IF INDEX() = 1 THEN WINDOW_SUM([isActive])END
*Optional: To include records that have no closed date, use IFNULL() to convert the NULL values in the [Closed Date] field to some arbitrary future date:IFNULL([Closed Date],#1/1/2999#)