Skip to main content
Announcements
See why Qlik is a Leader in the 2024 Gartner® Magic Quadrant™ for Analytics & BI Platforms. Download Now
cancel
Showing results for 
Search instead for 
Did you mean: 
sankar_ganesh
Partner - Contributor III
Partner - Contributor III

Problem with set analysis - max expression

ProductSales_DateSales
a03/20/201410
a03/20/20145
a03/19/201420
a03/18/201430
b02/28/201440
b02/28/201420
b02/20/201450
b02/10/201460

Hi, The above table is the example source data for my report...i need to find the sum of sales  occured on the latest sales date of each product to obtain the result shown below..

Result table to be shown:

ProductSalesAt_LatestDate
a15
b60

sum({<Sales_Date={'$(=maxstring(Sales_Date))'}>}Sales)

i used the above expression but i get only the the first row given in the result table as the maxstring(Sales_Date) is evaluated for the whole data not for each product. Does anyone have any idea to resolve this issue i.e. to evaluate the max(sales_date)  for each product ?

1 Solution

Accepted Solutions
Nicole-Smith

sum({<Sales_Date={'=Sales_Date=aggr(maxstring(Sales_Date),Product)'}>}Sales)

Example file also attached.

View solution in original post

3 Replies
Gysbert_Wassenaar

sum(if(Sales_Date=aggr(nodistinct max(Sales_Date),Product),Sales))


talk is cheap, supply exceeds demand
Nicole-Smith

sum({<Sales_Date={'=Sales_Date=aggr(maxstring(Sales_Date),Product)'}>}Sales)

Example file also attached.

SunilChauhan
Champion II
Champion II

sum({<Sales_Date={$(=Max(Sales_Date))}>}Sales)


make sure date format is not text

Sunil Chauhan