![]() ![]() The following script achieves the result. For this, we also take the help of the peek function discussed in the earlier chapter to hold the value of the previous record and add it to the sales volume of the current record. With the above data loaded into QlikView’s memory, we edit the script to add a new column, which will give a rolling sum of the month wise sales volume. (txt, codepage is 1252, embedded labels, delimiter is ',', msq) Applying RangeSum() Function Click OK and click Control+R to load the data into QlikView’s memory. Edit the load script to add the following code. Choose the Table Files option from the Data from Files tab and browse for the file containing the above data. Open the Script editor from the File menu or press Control+E. The above data is loaded to QlikView memory by using the script editor. It can take expressions containing other functions as its arguments and return the sum of those expressions. The RangeSum() function in QlikView is used to do a selective sum on chosen fields which is not easily achieved by the sum function. Clicking OK displays the data from the CSV file in the QlikView Table Box as shown below. The following window appears in which we mention the Title of the table and select the required fields to be displayed. Go to the menu item Layout → New Sheet Object → Table Box. Let us create a Table Box sheet object to show the data generated by the above script. (txt, codepage is 1252, embedded labels, delimiter is ‘,’, msq) ((-peek(‘Sales Volume’)))/peek(‘Sales Volume’)*100 as Difference The following script achieves this result. Let us display the percentage change for sales volume for each month. The peek() can be used in calculations involving other columns. On completing the above steps and clicking Finish, we get the Table box showing the data as given below. Also set the sort order as shown below to get the result in the same order of the field Month as it is in the source. Clicking OK displays the data from the csv file in the QlikView Table Box as shown below. ![]() (txt, codepage is 1252, embedded labels, delimiter is ',', msq) Creating Sheet Object Choose the Table Files option from for the file containing the above data. Save the data with file name monthly_sales.csv. Let us consider the monthly sales figure as shown below. The peek() function in QlikView is used to fetch the value of a field from a previous record and use it in calculations. Using Peek and RangeSum Function in QlikView
0 Comments
Leave a Reply. |