Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

arn93xavi
New Contributor II

How to obtain the sales of the previous year?

Hello, I am new to Qlik sense, and I want to compare the sales of the previous year with the current selected year.

Example

                2017      2016           difference

sales           x1           x2                x1-x2

The format of the dimension DATE is ddmmyyyy.

I'm using sum ({$ <DATE.autoCalendar.Year = {$ (# = Only (DATE.autoCalendar.Year) -1)}>} Sales), but it does not work for me.

Please help

my date table is this and I want to be able to get the sales of the previous year selected. For example if I have selected 2017 then the sales of the previous year (2016 in this case) would be 2050.

Sin título.jpeg

1 Solution

Accepted Solutions
MVP
MVP

Re: How to obtain the sales of the previous year?

Try this in a KPI object

Sum({$<[date.autoCalendar.Year] = {"$(=Year(YearStart(Max([date.autoCalendar.Year]),-1)))"}>}TOTALUSD)

8 Replies
MVP
MVP

Re: How to obtain the sales of the previous year?

Is Year your dimension? If it is then you will need to use Above/Below function to do this rather than using set analysis

arn93xavi
New Contributor II

Re: How to obtain the sales of the previous year?

yes, the dimension is the year, but the data is of type dd-mm-yyyy

MVP
MVP

Re: How to obtain the sales of the previous year?

For Difference, you can try this

Sum(Sales)-After(Sum(Sales))

arn93xavi
New Contributor II

Re: How to obtain the sales of the previous year?

my date table is this and I want to be able to get the sales of the previous year selected. For example if I have selected 2017 then the sales of the previous year (2016 in this case) would be 2050 dls. Sin título.jpeg

MVP
MVP

Re: How to obtain the sales of the previous year?

Might be easy if you can share a sample .qvf where you are trying this as it will clarify a lot of things...

arn93xavi
New Contributor II

Re: How to obtain the sales of the previous year?

I already did, I hope you can help me. Thanks

MVP
MVP

Re: How to obtain the sales of the previous year?

Try this in a KPI object

Sum({$<[date.autoCalendar.Year] = {"$(=Year(YearStart(Max([date.autoCalendar.Year]),-1)))"}>}TOTALUSD)

arn93xavi
New Contributor II

Re: How to obtain the sales of the previous year?

It works thank you very much!