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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Need to display data comparing two years sales

Hi

I have data for two years Sales ..

I need to display them in a single graph(Line graph) to compare this year sales with last year sales..

The current year has not ended, it has few more months left

I used Set Analysis,the following expressions used as in User manual.it does not yield the desired output i expected

=Sum({$<Year={$(=Only(Year))}>} [Sales Amount]) - Sum({$<Year={$(=Only(Year)-1)}>} [Sales Amount])

Attaching the graph which i get while using this expression & the desired output

Desired Output.jpgMy output.jpg

Any help is appreciated in resolving this..

Regards

5 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Works for me. See attached example.

Read this document if you need more help: Preparing examples for Upload - Reduction and Data Scrambling


talk is cheap, supply exceeds demand
nizamsha
Specialist II
Specialist II

sum({$<year={"$(=only(year))"}>}sales) //current year

sum({$<year={"$(=only(year)-1)"}>}sales) //last year

sum({$<year={"$(=only(year))"}>}sales)-sum({$<year={"$(=only(year)-1)"}>}sales) //difference between the year

nirav_bhimani
Partner - Specialist
Partner - Specialist

Hi,

If you want to compare the value of current year till current month then used the following expression.

FISCAL_MONTHNum is Months in numeric

Sum({$<YEAR = {"$(=Max(YEAR ))"}, FISCAL_MONTHNum={"<$(=num(Month(Today())))"}>} [Sales Amount])

Sum({$<YEAR = {"$(=Max(YEAR )-1)"}>} [Sales Amount])

Regards,

Nirav Bhimani

Not applicable
Author


Tried out with the same it displays "No data to display"

Any help is appreciated in this regard..

Not applicable
Author

Hi

Why do you use Set analysis ?

You can use Year as dimension (or calculated dimension to display only last 2) and Month as dimension as well

Amount will be displayed along all the months from jan to dec

best regards

Chris