9 Replies Latest reply: Oct 12, 2012 6:52 AM by AK C

# Get sum of sales amount

Hi,

I am new to Qlikview. Need help.

I have two fields Year and Sales

I need expression to display sum of sales amount of years less than selected year.

• ###### Re: Get sum of sales amount

Hi,

Try this expression:

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

Regards

• ###### Re: Get sum of sales amount

Hello Vincent,

Thanks a lot.

Its working.

• ###### Re: Get sum of sales amount

you're welcome

• ###### Re: Get sum of sales amount

Hi, rajeshri

you can use Set Analysis to solve this.

store your selected year in a variable and then use set analysis

for example

sum( { \$ < Year = { "<>\$(vYear)" } > } Sales)

where vYear is a variable in which you store selected year

Regards

- Anil

• ###### Re: Get sum of sales amount

Maybe try a set expression with implicite field value definition using e() function:

=Sum({\$<Year= e() }>} Sales)

edit: I assumed that you want to exclude the selected year, if you want to just sum up all years prior the selected year, the first answer is correct

• ###### Re: Get sum of sales amount

Swuehl Sir,

Regards

IndianQvLover

• ###### Re: Get sum of sales amount

It shows sum of all except selected year.

I used <= instead of <> now its working.

• ###### Re: Get sum of sales amount

Thanks, you are grate and genious.

Regards

- IndianQvLover

• ###### Re: Get sum of sales amount

try this..

create a variable for the selected year.

selectedyear ==> IF(GetCurrentSelection(Year) = 0, Max(Year), GetCurrentSelection(Year))

Expression ==> IF(Year <= \$(selectedyear), SUM(Sales))

hope that helps..