Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Problem with variables.

Hi.

I create new application. I have the table with orders. I import it to the QlikView.

In the next step i create the temponary tables with orders on the year 2013 and 2014. I have columns with costs of orders in the year.

I need sum the data on column "Wartość". QlikView on the reload don't create variables and don't sum the data. Please Help Me...

Zamówienia:

LOAD [ID Zamówienia],

[Data zamówienia],

if(len([Data zamówienia])>0, 'P'&ceil(Month([Data zamówienia])/6)) as [Półrocze zamówienia],

     if(len([Data zamówienia])>0, 'Kw'&ceil(Month([Data zamówienia])/3)) as [Kwartał zamówienia],

     Year([Data zamówienia]) as [Rok zamówienia],

     Month([Data zamówienia]) as [Miesiąc zamówienia],

     WeekDay([Data zamówienia]) as [Dzień zamówienia],

     [ID Produktu],

     Ilość,

     [ID Kontrahenta],

     [ID Pracownika],

     Money(Wartosc) as Wartość

FROM

[DATA\XLS\Zamówienia.xlsx]

(ooxml, embedded labels, table is [Zamówienia 2014]);

// Temponary table: Orders 2013

SumaSprzedażyRok13:

LOAD Year([Data zamówienia]) as RokS2013,

Wartość as WartośćS2013

Resident Zamówienia

WHERE(Year([Data zamówienia])=2013);

LET vSprzedaż2013=SUM(WartośćS2013); // THIS IS PROBLEM

// Temponary table: Orders 2014

SumaSprzedażyRok14:

LOAD Year([Data zamówienia]) as RokS2014,

Wartość as WartośćS2014

Resident Zamówienia

WHERE(Year([Data zamówienia])=2014);

LET vSprzedaż2014=SUM(WartośćS2014); // THIS IS PROBLEM

DROP Tables SumaSprzedażyRok13, SumaSprzedażyRok14;

2 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

In the script you can only use aggregations like sum in a load statement. You can use the peek function to retrieve a value from a field and store it in a variable.


// Temponary table: Orders 2013

SumaSprzedażyRok13:

LOAD sum(Wartość) as WartośćS2013

Resident Zamówienia

WHERE(Year([Data zamówienia])=2013)

;

LET vSprzedaż2013=peek('WartośćS2013');


talk is cheap, supply exceeds demand
danieloberbilli
Specialist II
Specialist II

try this one: