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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
sridhar_sigired
Creator
Creator

Last 4 week from latest week - Latest week diffrence through Set Analysis

Hi,

I have confusion with set analysis whether i can use <= or >= with in set analysis.

I am trying to create last field in attached table which is "Difference with 5th Week". I have created pivot table as available in attachment except last field "Difference with 5th Week", i want to create it separately  with same dimension and want to keep right side of pivot table.

Here i want to create a expression Avg(last 4 weeks from previous week - amount) -Sum(latest week amount)..

Can you please help me how to take 4 weeks in set analysis (i will create variable), just need help on how to write expression.

1 Solution

Accepted Solutions
shraddha_g
Partner - Master III
Partner - Master III

Try

sum({<Week={"$(vLatestWeek)"}>}Sales)

View solution in original post

7 Replies
shraddha_g
Partner - Master III
Partner - Master III

You can use <= and >= in set analysis

sunny_talwar

There is one example of <= here:

Dates in Set Analysis

sridhar_sigired
Creator
Creator
Author

Hi Sunny,

When we use variable in set expression, we do use $, right?

I am creating expression for each of previous weekend and creating pivot table like below

Let vLatestWeek = Date(WeekEnd(Today()),'MM/DD/YYYY')

Let vPreviousWeek = Date(WeekEnd(Today(),-1),'MM/DD/YYYY') so on...

Expression is like below

sum({<Week={$('vLatestWeek')}>}Sales) or

sum({<Week={$(vLatestWeek)}>}Sales) or

It is not working, however i tested with below and working

sum({<Week={'10/23/2016')}>}Sales)

Do we need to remember any specific point while we use variable in set expression? Checked in help, and syntax looks correct.

shraddha_g
Partner - Master III
Partner - Master III

Try this:

sum({<Week={"$(=vLatestWeek)"}>}Sales)

sridhar_sigired
Creator
Creator
Author

Thanks Shraddha... Tried but not getting result.

shraddha_g
Partner - Master III
Partner - Master III

Try

sum({<Week={"$(vLatestWeek)"}>}Sales)

sridhar_sigired
Creator
Creator
Author

Nice thanks Shraddha for your time...