Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to compare this year and last year's sales data

Hi,

I am trying to do an expression to compare this year vs last year's sales data. Below is the formula that I am using. It showuld say in percentage.

=IF(MONTH(INVOICEDATE) > MONTH(TODAY()), 0, (SUM(IF(YEAR(INVOICEDATE) = YEAR(TODAY()), INVOICEAMOUNT, 0))/ SUM(IF(YEAR(INVOICEDATE) = YEAR(TODAY())-1, INVOICEAMOUNT, 0))) -1).

But, it is showing 0 for everything. Can anyone please assist me on this?

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

If you are doing the expression in a chart you can use set analysis:

sum({<Year={"=$(=Year(Today()))"}>})/sum({<{<Year={"=$(=Year(Today())-1)"}>} INVOICEAMOUNT)

View solution in original post

3 Replies
Anonymous
Not applicable
Author

The As-Of Table described in the recent blog post by Henric could give you inspiration for a good alternative solution.

maxgro
MVP
MVP

or may be this, always Henric

Year-over-Year Comparisons

Anonymous
Not applicable
Author

If you are doing the expression in a chart you can use set analysis:

sum({<Year={"=$(=Year(Today()))"}>})/sum({<{<Year={"=$(=Year(Today())-1)"}>} INVOICEAMOUNT)