Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
LINKEDIN LIVE: Democratizing data to enhance customer-centricity. JULY 29TH REGISTER TODAY
cancel
Showing results for 
Search instead for 
Did you mean: 
ritvik4BI
Partner
Partner

QlikView script to flow previous month values if current month value is zero

Hi All,

I have two fields-  Month and Sales. I have been trying to write the QlikView script for the following scenario:

If for a month, the Sales value is 0, then the previous month's value should flow into it.  For example if the Sales for the month June is 0, then the previous month i.e. May Sales value should flow into it. 

I have attached the excel file FYR. 

1 Reply
QFabian
Specialist II
Specialist II

Hi @ritvik4BI , please try this :

LOAD
      Month,
      if( Sales = 0, previous(Sales), Sales) as Sales
FROM [..\Downloads\Scenario101.xlsx] (ooxml, embedded labels, table is Sheet1);

 

This is the basic example, with previous function ,

Take care about your data types for ensure correct results, and about order logic too.

greetings!

QFabian