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

Prev YTD on Bar Chart

Hey,

I'm currently having an issue in Qlik Sense.

I'm calculating YTD for a certain Sales Item and it works using the following Expression:

SUM(aggr(rangesum(above(sum( {$<MonthYear>} InvoiceNetSalesTotal),0,12)),YearId,MonthYear))

So in my current table for each MonthYear (e.g."jan 2016")  I have a full accumulation of my Net Sales.

Now the question is how do you get the numbers for the previous year?

I've tried using:

SUM(aggr(rangesum(above(sum( {$<MonthYear>} InvoiceNetSalesTotal),12,12)),YearId,MonthYear))

But I can't seem to cross the the aggregation limit of YearId.

So my table should look like:

YearMonth:       YTD Current Year:                                             YTD Prev Year:

Jan 2016          (Sales for Jan 2016)                                           (Sales for Jan 2015) 
Feb 2016          (Sales for Jan + Feb 2016)                                (Sales for Jan + Feb 2015)

March 2016      (Sales for Jan + Feb + March 2016)                  (Sales for Jan + Feb + March 2015)
April 2016         (Sales for Jan + Feb + March + April 2016)       (Sales for Jan + Feb + March + April 2015)

Source for methodology of Calculation:

Accumulative Sums

1 Reply
sunny_talwar

May be look into this approach

The As-Of Table