Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Make your voice heard! Participate in the 2020 Wisdom of Crowds® Survey. BEGIN SURVEY
Not applicable

How to calculate sum for previous days


I have a situation here, my client wants to see the sum of profit for the past seven days on one row.


Product IDProduct NameTotal Profit
Profit Day 1Profit Day 2

There is 2 cases scenarios.

The first:

He wants to select a date and get the profit for the past 7 days.

For this one, I think it will be something like that:

=sum({< [Order Date]={'=([Selected Date]-1)'}>} [Total Amount Profit]) 

But for what I can see, the sum is done for all the transactions, not just for the transaction made on the selected date-1

The second:

He explicitly want to select the 7 days range.

This is what confusing me. I think he can't have both of them. I'm right ?

Thank you.

1 Reply

Re: How to calculate sum for previous days


first get your [Order Date] field modifier correct:

Dates in Set Analysis

I think it should be something like

=sum({< [Order Date]={$(=Date(Max([Selected Date])-1,'MM/DD/YYYY'))}>} [Total Amount Profit])

edit: Adapt the date function format code to the format used for [Order Date]