Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Highlighted
dgqlikview
New Contributor III

Compare YoY Sales in the same line graph

Hi everyone,


I want to see a simple line graph that shows a line for FY14 sales and a separate line for FY15 sales on the same line graph.  Data is ordered sequentially and example graph below.   I've read a few forums with very complicated suggestions for complicated datasets, but mine is simple - 2 cuts of the same dataset.    I assume I create an Expression with a formula  (e.g. Sales  where Year = 2014) and another Expression ( Sales  where Year = 2015), so what's the syntax to show only a limited selection of the same data ?

 

YearMonthSales
2014January65%
2014February72%
2014March66%
2014April50%
2014May60%
2015January70%
2015February73%
2015March80%
2015April70%
2015May65%

Untitled.png

And second question is - how do I then add a singular line that represents the target ?  So if Target is 80% across the year, can I do this another way that doesn't involve adding it line by line in to the source data ?

Thanks,

Dave

Tags (1)
1 Solution

Accepted Solutions
Not applicable

Re: Compare YoY Sales in the same line graph

Hi,

In the expression use this formula

=sum({<Year={'2014'}>}Sales)  for the YOY for 2014

=sum({<Year={'2015'}>}Sales) for YOY for 2015

5 Replies
Not applicable

Re: Compare YoY Sales in the same line graph

Hi,

In the expression use this formula

=sum({<Year={'2014'}>}Sales)  for the YOY for 2014

=sum({<Year={'2015'}>}Sales) for YOY for 2015

sasiparupudi1
Honored Contributor III

Re: Compare YoY Sales in the same line graph

try

sum({<Year={2015}>} Sales)

sum({<Year={2014}>} Sales)

gautik92
Valued Contributor III

Re: Compare YoY Sales in the same line graph

create a variable lik

vYear= max(Year)-1

then create a input box with variable vYear

create chart with expressions

sum({$<Year={$(=Max(Year))}>} Sales)

sum({$<Year={$(=Max(Year)-vYear)}>} Sales)


you can compare 2015 with 2014 and also with more previous years by changing values in input box

dgqlikview
New Contributor III

Re: Compare YoY Sales in the same line graph

Thanks everyone - I especially like the input box variable idea.

I've also just worked out how simple my second question is to answer 🙂

A third Expression with =80%

atkinsow
Valued Contributor II

Re: Compare YoY Sales in the same line graph

For your second question, you could also just add a Reference Line on the bottom right of the Presentation tab.

Reference Line.PNG