Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
ecabanas
Creator II
Creator II

Present year previous year analisys

Hi,

I have a floor databae dates and the sales. I would like to make comparisons year Vs previous year. I did some variables:

VMaxDate =(max(DATEFINANCIAL))   this returns 41333 because Datefinancial is a floor.

VPriorDate = vMaxYear -1 this returns 41332

I would like to do calculations with this variables, but with this results I couldn't do, did you know how to solve this problem?

Thank's

Eduard

1 Solution

Accepted Solutions
neha_shirsath
Specialist
Specialist

Hi,

Please make the corrections, the expression is as below-

For  Current Year :

Sum({<year= {$(=max(Year))}>}Sales)

For Previous Year :

Sum({<Year= {$(= max(Year-1))}>}Sales)

View solution in original post

11 Replies
sushil353
Master II
Master II

use date function:

Date(VMaxDate) and for previous year : =addmonths(date(VMaxDate),-12)

neha_shirsath
Specialist
Specialist

Hi,

Please see below example-

For Previous Month:

Sum({<Month= {"$(=MonthName(addmonths(max(date),-1))"}>}Sales)

For Current Month:

Sum({<Month= {"$(=Monthname(max(date)))"}>}Sales)

neha_shirsath
Specialist
Specialist

Hi,

Please make the corrections, the expression is as below-

For  Current Year :

Sum({<year= {$(=max(Year))}>}Sales)

For Previous Year :

Sum({<Year= {$(= max(Year-1))}>}Sales)

Not applicable

Hi

For  Current Year :

sum({<PERIOD_YEAR={"$(=max(PERIOD_YEAR)"}>}[Net Amount])

For Previous Year :

sum({<PERIOD_YEAR={"$(=max(PERIOD_YEAR)-1)"}>}[Net Amount])

it works

ecabanas
Creator II
Creator II
Author

Hi Neha,


The problem is when I want to apply the same logic to calculate the previous month!!

and doesnt work

Sum({<CalendarMonthName= {$(= max(CalendarMonthName-1))}>}IMPORTBRUT)

Not applicable

Hi

use the below exp for the monthname condition

=Month( AddMonths(START_DATE,-1))

neha_shirsath
Specialist
Specialist

Hi ecabanas,

Means you want to calculate for current YearMonth and Previous YearMonth?

Like for Dec2012 and Dec2011..

ecabanas
Creator II
Creator II
Author

yes, that's I want to do!!!!

nirav_bhimani
Partner - Specialist
Partner - Specialist

HI,

Try this for the last Year Month

Sum ({<Date = P({<Year={$(=max(Year)-1)}>}Date)>}Sales)

Regards,

Nirav Bhimani