Skip to main content

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
Welcome to Qlik Community! Check out our new navigation! FIND OUT MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
rthanga2
Contributor
Contributor

Calculating change in fields as new data is loaded every week.

Hello all,

I am new new qlik so please help out. Every week i will be loading 2 fields i.e Name and Score. What i want is to find the difference in score from current week to the one in past week. How should i write a script to back up last week and import current week and then find the difference between them?

Labels (2)
3 Replies
Vegar
MVP
MVP

The easy approach to your question would be.
LET vDate = today();
Data:
LOAD
Name,
Score,
$(vDate) as Date
FROM [YourSource];
Store Data into data_$(vDate).qvd (qvd);
Vegar
MVP
MVP

Oh, I misread your question, it is a bit more to it. I'll come back to you later on.
Vegar
MVP
MVP

If you follow my first step storing  daily data into qvds then you can do the following.

 

//LOAD ALL YOUR QVDS
DATA:
LOAD * FROM data_$(vDate).qvd (qvd)


FINALDATA:
NOCONCATENATE LOAD Name, [Score] - if(peek('Name')=Name, peek('Score') ,0)as ScoreChange, [Date] , [Score] Resident DATA order by Name ,Date asc; Drop table DATA;