Data Synthesis & Gap Filling: Impute & Generate Rows Tools
Overview & Learning Objectives
Missing records and incomplete timelines wreck time series analytics and machine learning algorithms. The `Imputation` tool substitutes missing values with statistical central tendencies (mean, median, mode, or user-defined constants) while tracking imputed flags. The `Generate Rows` tool creates synthetic sequences—such as filling missing calendar dates between start and end timestamps.
- Impute missing numeric values using statistical Mean, Median, or Custom Constants.
- Generate sequential calendar date ranges using the Generate Rows tool.
- Scaffold complete time-series grids to prevent missing-date data drops in business dashboards.
Industry Standard
Standard: Predictive modeling guidelines at McKinsey QuantumBlack mandate replacing missing values using Median imputation (rather than Mean) to prevent extreme outlier skew while generating binary `_Imputed` indicator columns for audit tracking.
Real-World Example: ScoopCraft Ice Cream Continuous Calendar Scaffolding
ScoopCraft generates a complete 365-day calendar grid to ensure dark-store outlets with zero sales on rainy days still display ₹0 rather than disappearing from reports.
| Tool Used | Input Configuration | Generated Output | Business Purpose |
|---|---|---|---|
| Generate Rows | Start: `2026-01-01` | Condition: `<= 2026-12-31` | Step: `+ 1 day` | 365 continuous calendar date rows | Eliminates missing date gaps in BI charts |
| Impute Tool | Field: `[store_daily_sales]` | Replace with: `User Specified (0)` | Converts NULLs on non-operational days to ₹0.00 | Accurate monthly average calculations |
| Impute Tool | Field: `[customer_rating]` | Replace with: `Median` | Fills missing feedback with store median rating | Clean inputs for store performance index |
Configuration & Core Workflow
-- Generate Rows Tool Configuration
Initialization Expression:
[Date] = ToDate("2026-01-01")
Condition Expression (Loop while TRUE):
[Date] <= ToDate("2026-12-31")
Loop Expression (Increment):
DateTimeAdd([Date], 1, "days")
Parameters Breakdown
Initialization Expression: Sets the starting value for the newly generated field (executed once on row creation).Condition Expression: While this expression evaluates to TRUE, the tool continues generating subsequent rows.Loop Expression: Formula that increments or updates the field value for each subsequent row in the loop.Imputation Values: Options: Average, Median, Mode, or User-Specified Value (e.g. 0).
Sample Walkthrough (Q&A)
Question: What happens if you accidentally write `[Date] >= ToDate("2026-01-01")` as the condition in Generate Rows?
Formula / Action: Initialization: 2026-01-01 | Condition: [Date] >= 2026-01-01 | Loop: +1 day
Result: Triggers an infinite generation loop that halts only when disk/RAM limit is reached!
Explanation: Because Date increments forever, it remains >= 2026-01-01 indefinitely. The condition must specify an upper boundary (`<= 2026-12-31`).
Common Mistakes & Limitations
- Creating an infinite loop in Generate Rows by forgetting an upper boundary condition or incrementing in the wrong direction.
- Using Mean imputation on highly skewed metrics (like executive salaries or ultra-high ticket sales), which distorts summary statistics.
Keyboard Shortcuts
| Action | Windows | Mac |
|---|---|---|
| Generate Numbers | Init: 1 | Cond: [Row] <= 100 | Loop: [Row] + 1 | Init: 1 |
| Impute Indicator | Check "Output Imputed Value Indicator Field" | Check Indicator |
Pro Tips & Modern Alternatives
- Use the `Multi-Row Formula` tool if missing values should be populated from the immediately preceding valid row (forward-fill / carry-forward).
- Use SQL `GENERATE_SERIES()` inside an Input Data query if operating directly on PostgreSQL.