Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to retain and compare values of a column from a table which is reloaded periodically?

Hello Everyone, I m fairly new to Qlik Sense. I'd like your advise on the following:

I am working with a table that is something similar to this:

Supplier NameSupplier Score

Supplier 1

30

Supplier 279
Supplier 355

This table is from an excel file. This excel file is updated weekly and is reloaded in Qlik Sense. What I want to do is, every time the user reloads the data, I want to store the "Supplier Score" in a different table by renaming it as "<Date>"

Essentially this new table will be a log of how the supplier score changes over time. It should look like this:

Supplier Name10/22/201810/29/201811/5/201811/12/2018
Supplier 130455510
Supplier 279808050
Supplier 355634412

This is the place I need help. First of all, I need to know how to construct a table like this, and secondly, I need to maintain just 4 weeks of data in this table. So when the data is loaded on 19th November 2018, the column of 22nd October 2018 is discarded and  the new column is added.


I can do this in Python and then just feed the table to qlik sense. But, it would be easier for the user if this happened in qlik itself.

After this table is constructed, I am using the cross table function to un-pivot this table and feed it into my line chart visualization.

Thank you for your help!

3 Replies
lironbaram
Partner - Master III
Partner - Master III

hi

why not build your table as you need it from the start

so when you load the data you just add a date field,

your basic scirpt looks like this :

Data:

load  [Supplier Name],

          [Supplier Score],

          today() as Date

from SourceTable;

///////////////loading the previous 3 dates from the Data qvd//////////

Load *

From Data.qvd (qvd)

where Date >=date(today()-21);

Store Data into Data.qvd;

CathyRDuvall
Contributor III
Contributor III

Liron,

Your idea will  work but need to replace in the load statement;

today() as Date to

Supplied Date  (manually added the report date along with the other information from the suppliers)

So that each entry is dated separately, then the where Date >= date(today()-21) will show only dates from previous 21 days.

Anonymous
Not applicable
Author

Hello Liron,

Thanks. This works.

But I have a question regarding the second part of your solution.

What if the data load is done manually and is not exactly a week apart? in this case I would want the 3 most recent columns. Is there a way to do that?

Also, could I assign the date to a variable and load the supplier score as follows:

vDate = today()

LOAD [Supplier Name], [Supplier Score] AS vDate

FROM <data source>

I ask because I will be running the crosstable() function after to get the following table:

Supplier NameDateScore
Supplier 110/22/201830
Supplier 110/29/201845
Supplier 111/05/201855