Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to calculate sum for previous days

Hi,

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

Exemple:

Product IDProduct NameTotal Profit
Profit Day 1Profit Day 2
1234AirPlane145,00$100,00$45,00$
3456Train345,00$200,00$45,00$

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
swuehl
MVP
MVP

Daniel,

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]