Skip to main content
Announcements
See why Qlik is a Leader in the 2024 Gartner® Magic Quadrant™ for Analytics & BI Platforms. Download Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

what is the wrong in this script

Hi I have a problem In the script, below

LOAD *,
(
if(Unit= Previous(Unit),previous(sales), 0)) as PREV_sales;
LOAD *
Resident Temp_Data
Order By DATE,Unit;;

the above script is not returning any previous value for that unit where I gone wrong, can any one help me on this.

for sample data PFA.

Regards

John

1 Solution

Accepted Solutions
Not applicable
Author

I got the answer. Thanks All.

View solution in original post

7 Replies
Ralf-Narfeldt
Employee
Employee

Field names are case sensitive, so you need to refer it as Unit in all places.

qlikmsg4u
Specialist
Specialist

Original field names are Unit and Sales  but you refer as unit and sales (Check Case Sensitive)

Try this

LOAD *,
(
if(Unit= Previous(Unit),previous(Sales), 0)) as PREV_sales;
LOAD *
Resident Temp_Scott_Mileage_Data
Order By DATE,Unit;;

vardhancse
Specialist III
Specialist III

Scott_Mileage_Data:

LOAD *,
(
if(Unit= Previous(Unit),previous(Sales), 0)) as PREV_sales;
LOAD *
Resident Temp_Scott_Mileage_Data
Order By DATE,Unit;

Drop Table Temp_Scott_Mileage_Data;

sasiparupudi1
Master III
Master III

Hi John

As others have already mentioned, please check the case of your field names in the script.. Have you managed to resolve your problem?

Sasi

qlikviewwizard
Master II
Master II

Hi Use this script.

Issue is with sales. Change to Sales.

Data:

LOAD *,

(if(Unit= Previous(Unit),previous(Sales), 0)) as PREV_sales;

LOAD Branch,

    Unit,

    Month,

    Sales,

    Year,

    Month1

FROM

Data.xlsx

(ooxml, embedded labels, table is Sheet1);

Not applicable
Author

I got the answer. Thanks All.

qlikviewwizard
Master II
Master II

johnDawson

Could you select correct answer and Helpful as you selected your comment.

Thank you.