# QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Join us for a live Q&A! September 21, 10 AM ET - Onboarding Fast in Qlik Sense SaaS! REGISTER
cancel
Showing results for
Did you mean:
Specialist

## date function

how can i compare between this year to last year sales in a pivot?

5 Replies
Specialist

D1=Date(DateField,'DD-MM-YYYY')

vCurYearDate1=Date(DateField,'DD-MM-YYYY');

You can us this two variables

sum({\$<Field=\$(vCurYearDate1)>} Sales);

sum({\$<Field=\$(vPrevYearDate)>} Sales);

MVP

Hii,

Following expressions

For Curr Year

=sum(\$<FiscalYear={\$(=max(FiscalYear))}>} Sales)

for Last Year

=sum(\$<FiscalYear={\$(=max(FiscalYear)-1)}>} Sales)

Vikas

Luminary Alumni

You can either add the field Year as a dimension or, if you don't want to add Year as a dimension, you can do:

Dimension tab: client (example)

Expression:

1) First expressions, called "Sales TY": sum({\$<Year = \$(=year(today())) >} Sales)

2) Second Expressions, called "Sales LY": sum({\$<Year = \$(=year(today())-1) >} Sales)

This will give you the Sales for this year and last year for the dimension Client.

Make sure you have in your model a field Year.

Hope this helps.

JV

Specialist
Author

it helped,

thank you

Not applicable

Select year as a dimension

=sum({<Date={\$(vmaxyear)},FinancialYear=,FinMonthName=>}Scores)

vmaxyear=max(year(Date))

=sum({<Date={\$(vmaxyear-1)},FinancialYear=,FinMonthName=>}Scores)

Community Browser