4 Replies Latest reply: May 6, 2014 11:52 AM by Jason Ashinhurst

# Summing a column then subtracting two dates

Hi all,

I am summing the totals for each measured day which is right when looking at one days worth of data in a column, but when I highlight two dates I want them to subtract each other and show in a column.

For example, the first column ‘unassigned’ should read 4/29/14 – 4/28/14
= (10,001).

It is reading  (4/29/14) 309,719 + (4/28/2014) 299,718 = 609,437 which is
incorrect.

Is this possible in Qlik? I attached a screen shot.

Thank you,

Jason

• ###### Re: Summing a column then subtracting two dates

Could you upload a small sample application to demo your data model and current analysis?

In general, using all records in your current selection within the aggregation is standard behaviour of QV analysis, so a

sum(VALUE) will sum up all values, limited by your date selections and grouped by the dimensions in the chart, but will not apply any different logic like calculating differences by default. So you would need to tell QV what do to, either in your chart expressions or maybe possibly in the script.

• ###### Re: Summing a column then subtracting two dates

Thank you Swuehl for the reply!

I was given these two formulas as well, but could not get them to work correctly.

Sum({\$<Date={\$(=Only(Date)-1)}>}LineSalesAmount) for the
previous day and

Sum({\$<Date={\$(=Only(Date)}>}LineSalesAmount) for the
current day.

Where can I upload a sample at? I am not seeing a link to add the qvw file.

• ###### Re: Re: Summing a column then subtracting two dates

In the "Reply" window, find "Use advanced editor" on the top right.  When you click it, there will be Attach on the bottom right.

• ###### Re: Re: Re: Summing a column then subtracting two dates

Thank you Michael!