Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

nedcliqs
Not applicable

Sum a range of Accounts

  Hi Community,

Please help with a simple formula to Sum a range of Account numbers as follows:

1. Sum Amount for the Accounts 5722  to 5728  ( I want to state a range NOT to list them all)

2. Sum Amount for the range of Accounts 2300 to 2480

3. Then Subtract (2.) from (1.)

Below is just a sample , the Accounts are way too many than this hence the reason why i cant use a formula such as

WHERE Acc IN (5722, 5722.........)

AccAmount
57226000
5723850
57246850
57257700
572614550
572722250
572836800
34699625
230014300
23306400
23607900
23904500
24203400
24501100
24802300
1 Solution

Accepted Solutions
atkinsow
Not applicable

Re: Sum a range of Accounts

If account is numeric you could try

sum({<Account={'>=2300<=2480'}>}Amount) - sum({<Account={'>=5722<=5728'}>}Amount)

5 Replies
atkinsow
Not applicable

Re: Sum a range of Accounts

If account is numeric you could try

sum({<Account={'>=2300<=2480'}>}Amount) - sum({<Account={'>=5722<=5728'}>}Amount)

Miguel_Angel_Baeyens
Not applicable

Re: Sum a range of Accounts

That syntax with double quotes as long as it is a search, single quotes work, but it's a known bug.

nedcliqs
Not applicable

Re: Sum a range of Accounts

Thanks @Wallo Atkinson, this worked correctly on my sample data.

I will apply then apply the formula on the model and see how it goes.

Once again, thank you

atkinsow
Not applicable

Re: Sum a range of Accounts

Good luck.  Hope it helps.

nedcliqs
Not applicable

Re: Sum a range of Accounts

Hi atkinsow‌, i applied the formula on my model. It worked like charm!

Thank you very much for helping here!