Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Karthick30
Creator
Creator

Up and Down Arrow based on Yesterday's Loaded Data

Hi,

 I am getting a Data set from Database.

It has so many columns. I am creating multiple KPI's like Count(userID) , Count (Emailaddress),.....

Now I have a requirement to show up/down arrow along with each KPI by comparing with last time loaded data. 

if today my count(userID) shows 9000 and tomorrow if count(userID) is 9010 means, I need to show along with Up arrow for tomo. 

we don't have any date fields in our Dataset. Any way to achieve this please

 

Labels (2)
6 Replies
edwin
Master II
Master II

you can save your latest data to a QVD.  then the next run load the QVD first - this is your PREVIOUS data; query the data base this is your current data.  then save the data from your database to the same QVD so that the next run it becomes prior data.

obviously, you need to start with a QVD.  so for the first run you query the dB then save it to a QVD.  then update your script with your new logic (the one i mentioned above)

a facinating solution would be to binary load the application, drop the old table, rename the new table as old table, then load new table from the DB.  then youll have your old vs new

edwin
Master II
Master II

one tweak over "a facinating solution would be to binary load the application, drop the old table, rename the new table as old table, then load new table from the DB.  then youll have your old vs new"

when you binary load, you drop the old table; dont rename the new table - but create it as a load resident from the old table as you may want to have different field names.

 

you can obviously do with just one table - but with a flag that indicates which one is old and which one is new.  you delete the old records load resident the new records as old then load the new records from DB 

Karthick30
Creator
Creator
Author

Thanks @edwin 

But i have 3 tables from DB. Certain KPI's i have created based on 3 tables together ( by using Set Analysis ). So i have to load all 3 DB's as QVD First ?

Then I need only 2 days of records to be stored in that QVD. like today and Yesterday. once tomorrow data loaded , we don't need yesterday data. Like only two days data needs to be stored. Any way to get that?

 

edwin
Master II
Master II

you need to create 3 QVDs then - per table.  from your problem description you only need to store previous day in the QVD - you can always get the current day from the DB

 

Karthick30
Creator
Creator
Author

Yes Correct. I need to store only yesterday's data. But how can i dynamically store qvd data.

Foe Ex.. tomorrow , it has to delete all previous data's and store only yesterday's data in QVD. Likewise , it has to repeat for all days. How to achieve that

edwin
Master II
Master II

you dont delete prior data, you just dont load it.  you have control over how you load your data depending on your data model.  for example if you save yesterday's and current data into different tables, you obviously save just the table you want to save which is obviously the new data (to become old data next day)