The Fill function in QlikView is used to fill values from existing fields into a new field.
Input Data
Let us consider the following input data, which represents the actual and forecasted sales figures.
Month,Forecast,Actual
March,2145,2247
April,2458,
May,1245,
June,5124,3652
July,7421,7514
August,2584,
September,5314,4251
October,7846,6354
November,6532,7451
December,4625,1424
January,8547,7852
February,3265,
Load Script
The above data is loaded to the QlikView memory by using the script editor. Open the Script editor from the File menu or press Control+E. Choose the “Table Files” option from the “Data from Files” tab and browse for the file containing the above data.
After clicking Next in the above step, we choose the Enable Transformation Step button to carry out the required data transformation.
Selecting the Data Transformation
As we are going to use the Fill function, let us choose the Fill tab, which displays the empty values under the Actual Field.
Create the Fill Condition
On clicking the Fill button, the option to choose the target column and the cell condition appears. We choose column three, as we want to fill the empty values of this column with values from the same row in column two. Also, choose the Cell Value as empty so that only the empty cells will be overwritten with new values.
Transformed Data
On completing the above steps, we get the transformed data as shown below.
Load Script for transformed Data
The loaded script for the transformed data can be seen using the script editor. The script shows the expression, which replaces the empty cell values.
Display Transformed Data
The transformed data can be seen by creating a Table Box using the option in the menu Layout → New Sheet Object.