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: 
alec1982
Specialist II
Specialist II

Set Analysis

Hi guys,

I need to do Sum amount of the most recent date. The below formula sums everything in the past. Is there away to fix to show only the most recent period amount?

=Sum({$<[Date]={"<$(=today())"},[Type]={'AR'}>}[Amount])

1 Solution

Accepted Solutions
maxgro
MVP
MVP

maybe

=FirstSortedValue({$<Date={"<$(=today())"}>} Amount, -Date)

or

=subfield(concat(aggr(sum({$<Date={"<$(=today())"}>} Amount),Date), '-', -Date), '-',1)

View solution in original post

6 Replies
maxgro
MVP
MVP

what do you mean for

the most recent period

?

jolivares
Specialist
Specialist

Change to :

=Sum({$<[Date]={">=$(=today())"},[Type]={'AR'}>}[Amount])


Your expression sum all amount before today, changing the bracket you sum from today to....

alec1982
Specialist II
Specialist II
Author

I want to sum amounts paid in the past or today but only one line(Most Recent).

Date               Amount

05/01/2014     100

06/01/2014     250

06/07/2014     500

07/01/2014     220

in this case the result should be 250

alec1982
Specialist II
Specialist II
Author

here is the formula to calculate the desired date.. but not sure how to get the amount

date(max({$<[Payment Date]={"<=$(=today())"}>}[Payment Date]))

alec1982
Specialist II
Specialist II
Author

most recent means the last Amount scheduled today or prior to today's date.

maxgro
MVP
MVP

maybe

=FirstSortedValue({$<Date={"<$(=today())"}>} Amount, -Date)

or

=subfield(concat(aggr(sum({$<Date={"<$(=today())"}>} Amount),Date), '-', -Date), '-',1)