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

Announcements
ALERT: QlikView server communication interruptions following Microsoft Windows Domain Controller security updates
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Find the last week & year

Hi all,

I have concatenated year and week as mentioned in the below

SEMAINE_ANNEE

2016|1

2016|2

2016|3

2016|51

2016|52

2017|1

2017|2

2017|3

Now i want to calculate the stock movement by adding the turnover based on the last three weeks in the selected list and divide the stock quantity of the last week in my selection.

Example: Sum (CA) 2017|1, 2017|2, 2017|3 / (divided) by Sum (STOCK) of 2017|3

Can anyone hint me, how to find the last (MAX) three weeks from the SEMAINE_ANNE selection. and also the last week (MAX)

They are in string format.

Regards

Djega

Labels (1)
2 Replies
tresB
Champion III
Champion III

Recreate a the field with a dual value like:

Dual(SEMAINE_ANNEE,SubField(SEMAINE_ANNEE,'|',1)*100+SubField(SEMAINE_ANNEE,'|',2)) as SEMAINE_ANNEE

And then front end expression like:

=Sum({<SEMAINE_ANNEE={"=Rank(SEMAINE_ANNEE)<4"}>}STOCK)


Once your field is created with dual value, you can directly use any numerical function like max(), min()...

=Max(SEMAINE_ANNEE)

muthukumar77
Partner - Creator III
Partner - Creator III

Hi,

Create Autonumber of SEMAINE_ANNEE order by Year and Week.

It will be like this,

SEMAINE_ANNEE Autonum

2016|1    1

2016|2    2

2016|3    3

2016|51  4

2016|52  5

2017|1   6

2017|2   7

2017|3   8

Sum({$<AutoNum={">=$(=Max(AutoNum)-2)<=$(=Max(AutoNum))"}>}CA) / Sum({$<AutoNum={$(=Max(AutoNum))}>}STOCK)

Muthukumar Pandiyan