Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Sales Last / Previous Week

Hi Guys,

I need an comparisation between Sales current week vs last week. But I need the possibility to select a week so the function above or below doesn't work. Here is my Sales table;

What is the proper set analysis for getting the previous record?

Pls advice

Regards,

Robert

   

WeekYPrevious OrderportfolioCurrent Orderportfolio
2015/377.363.2487.854.268
2015/367.038.3897.363.248
2015/357.025.4137.038.389
2015/347.373.3567.025.413
2015/337.319.9927.373.356
2015/326.876.9617.319.992
2015/317.009.2646.876.961
2015/306.666.9267.009.264
8 Replies
sunny_talwar

This seems like already aggregated (expected) data, can you share raw data?

Anonymous
Not applicable
Author

Hi Sunny,

Yes, sum of

but it's just what i did in Excel. Now i need a set analysis to reproduce the same data.

Can you use this as sample data?

Rob

sunny_talwar

Do you have two columns in your database for Current and Previous period? or is it just one column and this is a kind of display you want to create?

jonathandienst
Partner - Champion III
Partner - Champion III

Set analysis will not help in a row-by-row expression such as previous week. A set expression is evaluated once for the table and not on a row by row basis.

Have a look at Above() or Below() chart functions if you want to do this in a table.

For example, a straight table

  • Dimension: WeekY
  • Expression1: your existing expression for current portfolio
  • Expression2: =Below(Column(1))    for previous portfolio
Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Anonymous
Not applicable
Author

Yes, correct.

It's just one column (Sales) with the value. Previous is the calculation i need.

Rob

Anonymous
Not applicable
Author

Hi Jonathan,

Thanks for reply.

If i use the functions,I cannot select a certain week (like wk 2015/35), because this will show me zero for previous. column. Logic because I do not have a below or above records...

sasiparupudi1
Master III
Master III

Try

t1:

load * Inline

[

WeekY,Current Orderportfolio

2015/37,7.854.268

2015/36,7.363.248

2015/35,7.038.389

2015/34,7.025.413

2015/33,7.373.356

2015/32,7.319.992

2015/31,6.876.961

2015/30,7.009.264

];

NoConcatenate

t2:

LOAD

WeekY,[Current Orderportfolio],if (isnull(Peek([Current Orderportfolio])),0,Peek([Current Orderportfolio])) as [Previous Orderportfolio]

Resident t1 order by WeekY;

drop Table t1;

sunny_talwar

May be this:

Script:

Table:

LOAD *,

  Rand() * 100000 as Value;

LOAD Year(Today() - RecNo()) & '/' & Week(Today()-RecNo()) as YearWeek,

  Date(Today() - RecNo()) as Date,

  Year(Today() - RecNo()) as Year

AutoGenerate 618;

How it looks in Table Box:

Capture.PNG

Straight Table:

Dimension: YearWeek

Expressions

1) 2015: =Sum({<Date = {"$(='>=' & Date(YearStart(Max(Date))) & '<=' & Date(Max(Date)))"}>}Value)

2) 2014: =If(Sum({<Date = {"$(='>=' & Date(YearStart(Max(Date))) & '<=' & Date(Max(Date)))"}>}Value) > 0, Above(Sum({<Date = , YearWeek = >}Value), 52))

With no selection:

Capture.PNG

With Selections:

Capture.PNG

I hope this is what you are looking for.

Best,

Sunny