--- title: "FILLFORWARD function" slug: "fillforward-function" tags: ["modeling", "functions "] updated: 2025-10-29T11:46:17Z published: 2025-10-29T11:46:17Z canonical: "kb.pigment.com/fillforward-function" --- > ## Documentation Index > Fetch the complete documentation index at: https://kb.pigment.com/llms.txt > Use this file to discover all available pages before exploring further. # FILLFORWARD function ## Description Returns an expression (Metric or List Property) with blanks replaced by the preceding non-blank value along the specified Dimension. This function is non-iterative. Unlike the `PREVIOUS` function, which works iteratively on each cell, `FILLFORWARD` applies the computation in a single pass across the entire Metric. This makes it more efficient and also not bound by the current limitations on `PREVIOUS`, which can iteratively compute up to 10,000 Items in a Dimension. Typical use cases include filling missing values in time series data or propagating categorical assignments where intermediate values are missing. Unlike `PREVIOUS`, `FILLFORWARD` does not act on the current Metric. Also, if used inside conditional formulas (`IF`), it fills the blanks for the entire Metric first, and only then applies the condition. **Related function**: `PREVIOUS` ## Syntax ```css FILLFORWARD(Expression, Dimension [ON clause]) ``` ## Arguments | **Argument** | **Type** | **Dimensions** | **Description** | | --- | --- | --- | --- | | Expression (required) | Any type | Defined on `Dimension` | The expression (Metric or List Property) containing the values to fill. | | Dimension (required) | Dimension | Any Dimension | The Dimension along which blank values will be filled forward. | | ON clause (optional) | Ranking expression | Same Dimension | Defines the ranking order for filling values. By default, data will be filled **forward. Backward data filling** can be done by reversing the ranking in the ON clause. See Example 2 below. | ## Returns | **Type** | **Dimensions** | | --- | --- | | Same as `Expression` | Same as `Expression` | ## Examples You input spot forecasts for three Vacuum Cleaner products in a Metric called **Month Forecast Inputs**. You leave blank the months that are unchanged from the month prior: ![](https://cdn.document360.io/e47cfe35-dc28-40c7-a083-6cf003073d8e/Images/Documentation/image(219).png?sv=2026-02-06&spr=https&st=2026-11-17T09%3A59%3A25Z&se=2026-11-17T10%3A59%3A25Z&sr=b&sp=r&sig=mFHiwiSEo%2B3Xf8meep08J21injNsaedeXPPy15TpJ00%3D) ### Example 1 In a separate Metric, **Baseline Month Forecast**, you use FILLFORWARD to fill the blanks: ```css FILLFORWARD('Month forecast inputs',Month) ``` ![](data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==) ![](https://cdn.document360.io/e47cfe35-dc28-40c7-a083-6cf003073d8e/Images/Documentation/image(220).png?sv=2026-02-06&spr=https&st=2026-11-17T09%3A59%3A25Z&se=2026-11-17T10%3A59%3A25Z&sr=b&sp=r&sig=LzjVqRRHHuzaIXCxqyFGmPvlBDdxHmeBTKBeYnpJtWc%3D) ### Example 2 You use the ON operator with the [RANK function](/v1/docs/rank-function) to reverse the fill direction. **Month** alone does not rank by default, you need to reference its **Start Date** Property: ```css FILLFORWARD('Month forecast inputs',Month ON RANK(Month.'Start Date',0,DESC)) ``` ![](data:image/gif;base64,R0lGODlhAQABAPABAP///wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==) ![](https://cdn.document360.io/e47cfe35-dc28-40c7-a083-6cf003073d8e/Images/Documentation/image(221).png?sv=2026-02-06&spr=https&st=2026-11-17T09%3A59%3A25Z&se=2026-11-17T10%3A59%3A25Z&sr=b&sp=r&sig=X5QmoolSIuxnBIR2JuWcYFiji6iK82lDKU01H%2FzKqnk%3D) ## Best Practices ### When to Use `FILLFORWARD` - **Efficient filling of missing values**: Use `FILLFORWARD` when you need to fill blanks across an entire Metric quickly and efficiently. - **Custom ranking**: Apply it when you need forward- or backward-filling controlled by a specific ordering (e.g. descending date, business priority). - **Time series continuity**: Useful for metrics like rolling headcount, sales pipeline status, or last known assignment. ### When to Use `PREVIOUS` Instead - **Cell-level iteration**: If you need row-by-row iterative logic that interacts with conditions at the cell level, `PREVIOUS` is the better choice. - **Formulas relying on IF conditions**: `PREVIOUS` applies `IF` at each modality step, whereas `FILLFORWARD` fills globally first, which can lead to different results. > [!WARNING] > ⚠️ Important > > Sparse datasets allow for much faster computation. The FILLFORWARD function can densify your model, as it adds values in its Metrics, reducing performance. ## Limitations - **Cannot act on current Metric directly**: Always requires an explicit Metric as the `Value` argument. - **Not suitable for cumulative calculations**: Use `CUMULATE` or iterative functions if you need true cumulative behavior, not just filling blanks. - **Blank initialization**: If no non-blank value exists before a blank, the cell remains blank.