Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
thanhphongle
Creator II
Creator II

maximum of sum(sales) of a year

Hello Community,

this is my table

DateSales
01.01.20151000
01.07.20152000
01.09.20153000
01.01.20165000
01.04.20167000
01.01.20172000

how can I get

the biggest sum of sales per year?

QV should return me

12.000 € for the year 2016

I tried this expression. but it didnt work

=max(aggr(sum(Sales), year(Date)))

Could anyone help me out here?

1 Solution

Accepted Solutions
Anil_Babu_Samineni

Try this?

Make sure to create Year field in Script like and Be aware of Date format of your environment

Year(Date) as Year

Then Set analysis, May be this

Sum({<Year = {'$(=Max(Year-1))'}>}Sales)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful

View solution in original post

6 Replies
Anil_Babu_Samineni

Try this?

Make sure to create Year field in Script like and Be aware of Date format of your environment

Year(Date) as Year

Then Set analysis, May be this

Sum({<Year = {'$(=Max(Year-1))'}>}Sales)

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
tresesco
MVP
MVP

Create a Year field in the script like:

Load

          Year(Date) as Year

And then in the front-end try :  = max(aggr(sum(Sales), Year))

thanhphongle
Creator II
Creator II
Author

it works, thank you ! but is there another possibility without changing the script?

tresesco
MVP
MVP

If even possible (I doubt though), would not be an easy one. Creating a year/month field in the script is very common fact in BI, so I would not even try to find an alternative in the front-end.

c_gilbert
Creator II
Creator II

= max(aggr(sum(Sales), Year(Date)))

Ajaysantosh
Contributor
Contributor

your suggest expression don't work it's hide all table data so please show me the correct expression

thank you