Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to get sale of current year and last year in a single graph with two expression

How to get sale of current year and last year in a single graph with two expression

i"m using this expresion

current year:=SUM({<FiscalYearName={'$(vCFY)' },Flag={'IFK'}  >}_Revenue)/sum(([Total No of SALE]))

last year:

=SUM({<FiscalYearName={'$(vLFY)' },Flag={'IFK'}  >}_Revenue)/sum(([Total No of Meal]))

5 Replies
tresesco
MVP
MVP

If your variables are defined properly and FiscalYearName field data format are similar to variable output, it should work fine. Otherwise, try to post your sample qvw.

vikasmahajan

Please Refer Attachment of Document and prepare variable will definitely solve your problem.

Vikas

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.
Peter_Cammaert
Partner - Champion III
Partner - Champion III

What exactly isn't working for you? Or are you just checking if this is the proper approach?

It is, but not 100%. Please consider:

  • current year divides by the [Total No of SALE] of whatever year is currently selected. You may even select 2 or three years.
  • the same applies to your last year expression. Maybe you should add set analysis to whatever expression you divide by (numerator)
  • also you can use <FiscalYearName={'$(=Max{1}FiscalYearName)'}, Flag=...to lock the current year expression to the most recent year loaded. last year then becomes <FiscalYearName={'$(=Max({1}FiscalYearName)-1)'}, Flag=... Note that this only works for numerical FiscalYearName values. If this field contains strings, attach a sequential order number to the FiscalYearName values (1, 2, 3...) upon loading in your script, and use that field in set analysis instead.

Good luck,

Peter

jagan
Luminary Alumni
Luminary Alumni

Hi,

What is the definition of the variables?  what is the format of Fiscal Year?

If your Fiscal Year is in this format then try like htis

vCFY = Max(FiscalYear)

vLFY= Max(FiscalYear) - 1


current year:=SUM({<FiscalYearName={'$(vCFY)' },Flag={'IFK'}  >}_Revenue)/sum(([Total No of SALE]))

last year:=SUM({<FiscalYearName={'$(vLFY)' },Flag={'IFK'}  >}_Revenue)/sum(([Total No of Meal]))

Regards,

Jagan.




Anonymous
Not applicable
Author

Hi Yogita,

You need to Create the two separate expression to view the Comparison of the Current Year Vs :Last Year.

1st Expression is SUM({<FiscalYearName={'$(vCFY)' },Flag={'IFK'}  >}_Revenue)/sum(([Total No of SALE]))

2nd Expression is SUM({<FiscalYearName={'$(vLFY)' },Flag={'IFK'}  >}_Revenue)/sum(([Total No of Meal]))

& Your Dimension should be the concessionaire name.

vCFY & vLFY variables should be added in your application.

or you can show the growth also like what is the growth of Current Year Over the Last Year.

Hope this might helps you.

Regards,

Alok