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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
microwin88x
Creator III
Creator III

Sales Variation Expression

Hello,


I have the following table:

Year

Sales

Previous Year Sales

Sales Variation

2010

1800

-

  -

2011

2100

1800

17%

2012

2300

2100

10%

2013

3000

2300

30%

2014

3250

3000

8%

2015

4000

3250

23%

2016

3500

4000

-13%


I created the expression Sales Variation with ABOVE function which is OK if I don't make any selection.


But when I select a year, I lose the value from Previous Year Sales:

YearSalesPrevious Year SalesSales Variation

2014

3250

-

-

If you know any other way to do this, I'd really appreciate it.


Thank you!

Labels (1)
5 Replies
sergio0592
Specialist III
Specialist III

Hi,

I think your chart is not build as a classical KPI should be built. Don't use above function, use two expressions:

Sales N : sales current year

Sales N-1 : sales previous year

and sales variation expression : ("Sales N"-"Sales N-1") / "Sales N-1"

rupamjyotidas
Specialist
Specialist

'Above' won't work when you make selection, best bet here is using 'Previous' or 'Peek' in Script

m_woolf
Master II
Master II

I think your percents are all wrong. See the attached qvw:

rupamjyotidas
Specialist
Specialist

Here is the example:

LOAD Year,

     Sales,

     [Previous Year Sales],

(     (Sales- Peek(Sales))/Peek(Sales))*100 as [Sales Variation]

FROM

[https://community.qlik.com/thread/234380]

(html, codepage is 1252, embedded labels, table is @1);

Not applicable

can u show ur script please