Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Week vs LY Week Comparison

Hi

I am new to qlik view and trying to compare Week vs LY Week Comparison in Chart object.

My Data is as below.

in LY Sales column I want sales of Week 1711 , 1712 , 1713 ...?

WeekCY SalesLY Sales
18111000??
18121000??
18131000??
18141000??

I am using SET operation to get the same and therea are no altrernate state used here. Can you please help me with hiw to get it.

Expressions I tried here is :

 

SUM

({$<Week={$(=Only(Week)-1)}>}NetSales)


7 Replies
MK_QSL
MVP
MVP

Try

SUM({<Week = {'$(=Max(Week)-1)'}>}NetSales)

Is it Last Week or Last Year Week?

Not applicable
Author

It need to LY week. T

The solution mentioned below returned data only week 1813 Row

and the number in the LY column was for the same week (1813).

This is not I am expecting to be. The number in the LY column should be week 1812.

rogerioqv
Creator II
Creator II

Rahul...

Analyze the functions above and below!

lironbaram
Partner - Master III
Partner - Master III

hi

have a look at the attach example

the method is to use year field to move a year back

and a week field that holds the same number each year

than using a aggr function you get what you want

Not applicable
Author

Hi ,

I tried what is mentioned below and different option.

SUM({<Week_No = {'$(=(Week_No)-1)'}>}NetSales) -- returs all records as 0

SUM({<Week_No = {'$(=Only(Week_No)-1)'}>}NetSales)  -- returs all records as 0

SUM({<Week_No = {'$(=MAX(Week_No)-100)'}>}NetSales) -- returns only for the week row with week 1713 and the data is for the week LY 1713 week only .

Ideal scenario data should be agaist row with week No 1813 and LY column in row 1813 should have data of 1713.

My base data is at week grain.

lironbaram
Partner - Master III
Partner - Master III

hi you cant use the set analysis on the week field as it returns for all rows the data from the max week

in your case 1813

you need to use the year field if you have one or create one in the script

i've attached an example in another post in this thread have a look at it

Not applicable
Author

Thank you all your inputs helped me understand set and yes my probelm was solved too.