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

How to ignore the dimension and show the sales for last year

Hello,

Can anyone help me with this please? The dimension is Date. First expression is sum(Sales) and for the second expression, we want to have the sales for the last year (Date-364). We can do this by using a SelectDate as the dimension but that causes the CPU to 100% and then we have to kill the process.

Date sum(Sales) LY Sales
$33375 ?
1/10/2010$1817?
2/10/2010$431?
3/10/2010$5521?
4/10/2010$0?
5/10/2010$0?
6/10/2010$3448?
7/10/2010$321?
8/10/2010$901?
9/10/2010$1775?
10/10/2010$819?
11/10/2010$0?
12/10/2010$0?
13/10/2010$1597?
14/10/2010$1570?
15/10/2010$189?
16/10/2010$1767?
17/10/2010$1802?
18/10/2010$0?
19/10/2010$0?
20/10/2010$47?
21/10/2010$2843?
22/10/2010$2517?
23/10/2010$648?
24/10/2010$988?
25/10/2010$0?
26/10/2010$0?
27/10/2010$2154?
28/10/2010$275?
29/10/2010$1247?
30/10/2010$553?
31/10/2010$144?

Thanks heaps in advance.

Fei

4 Replies
Not applicable

hi

try this

sum({<year={"$(=max(year-1))"}>}LY Sales)

for make the year field write,

date(date#(Date,'DD/MM/YYYY'),'YYYY') AS year

israrkhan
Specialist II
Specialist II

Hi,

for selected year

=sum(sales)...ok

for selected year -1 write,...previous year use.

=sum({<Year ={$(=Max(Year)-1)}>} LY Sales)...

and if you want to ignore dimension,but not selection, you want to bring up all sale for previous, than use,

=sum({<Year ={$(=Max(Year)-1)}>} TOTAL LY Sales)... TOTAL IGNORE ALL DIMENSIONS..

HOPE THIS HELP,

Kind Regards

Khan


NZFei
Partner - Specialist
Partner - Specialist
Author

Thank you very much for your reply. For selected Date, we have no problem to do this but performance is very bad. So finally we did the changes in the scripts by creating some flags.

Cheers.

Fei

sujeetsingh
Master III
Master III

For that you can try this by calculating the year in scripting.

See for PEEK() function.