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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
anuradhaa
Partner - Creator II
Partner - Creator II

Compare last Month value with Previous year same month value

I want to compare current month total with previous year current month total in set two columns in stragh table.

Say last month is April 2016 i want to compare it with 2015 april figures.

Is there a way to do so.

Thanks

5 Replies
sunny_talwar

You can use Above/Below functions, or if you can make scripting changes, I would suggest to look into the concept of AsOf Table -> The As-Of Table

anuradhaa
Partner - Creator II
Partner - Creator II
Author

CountryLast month Sales
USA15000 USD
UK1000 USD
France1200 USD

I don't use month in my table and i don't want to my table is like above

I want to add another column as Prev Year Sales for last month

sunny_talwar

May be like this:

Previous Year:

Sum({<DateField = {"$(='>=' & Date(AddYears(MonthStart(Max(DateField)), -1), 'DateFieldFormatHere') & '<=' Date(AddYears(MonthEnd(Max(DateField)), -1), 'DateFieldFormatHere'))"}, MonthField, YearField, MonthYearField, QuarterField>}Sales)

ramasaisaksoft

chetansehgal
Creator
Creator

You may try the below formulas:

Current year and Month:

=sum({<Year={$(=Year(Max(Date)))}, Month={$(=Month(Max(Date)))}>}Sales)

For last Year and Month

=sum({<Year={$(=Year(AddMonths(Max(Date),-12)))},

            Month={$(=Month(AddMonths(Max(Date),-12)))}>}Sales)