Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
dzmitry_shmurye
Partner - Creator
Partner - Creator

Sum of all largest values

Hi community!

I have a small table:

The first expresion is the simple sum.

I want get the second expresion with sum of the all values in the table but only values wich are largest than current string.

For example for Prod2 Sum 10+15+20 = 45 (all values >5, but not include 1)

Could somebody help me with this expresion?


Thanks!

1 Solution

Accepted Solutions
sunny_talwar

Script:

InitialData:

LOAD *,

  AutoNumber(Month1&Product1) as Key1;

LOAD Month(Date#(Month1, 'MMM')) as Month1,

  Product1,

  Amount1

Inline [

Month1, Product1, Amount1

Jan,  Prod1,  5

Jan,  Prod2,  10

Jan,  Prod3,  12

Feb,  Prod1,  1

Feb,  Prod2,  5

Feb,  Prod3,  3

Mar,  Prod1,  20

Mar,  Prod2,  14

Mar,  Prod3,  7

];

FinalTable:

LOAD Month1 as Month,

  Product1 as Product,

  Amount1 as Amount,

  Key1 as Key

Resident InitialData

Order By Month1, Amount1;


Capture.PNG


Expression:

=Sum(TOTAL <Month> Amount) - Aggr(RangeSum(Above(Sum(Amount), 0, RowNo())), Month, Key)

View solution in original post

31 Replies
tamilarasu
Champion
Champion

Try,

Sum({<Value={">5"}>}Total Value)

dzmitry_shmurye
Partner - Creator
Partner - Creator
Author

But I need do this for every row in table.

For example for the 1 rows it should be sum values only wich > 10 etc...

ThornOfCrowns
Specialist II
Specialist II

When you say 'greater than current string'  what do you mean by 'current string'?

dzmitry_shmurye
Partner - Creator
Partner - Creator
Author

Yes, exactly!

MindaugasBacius
Partner - Specialist III
Partner - Specialist III

Two cases:

  1. Result as the text object.
  2. Result as a table object with reduced data.
dzmitry_shmurye
Partner - Creator
Partner - Creator
Author

I need get the next values (different for every row):

sunny_talwar

May be this?

Capture.PNG

You will have to keep the sorting like this to get this to work in the solution I am proposing

Sum(Total Value) - RangeSum(Above(Sum(Value),0, RowNo()))

NOTE: Used Mindaugas Bacius‌ sample to make modification as I was too lazy to create my own

kkkumar82
Specialist III
Specialist III

Hi Sunny

Just curious can we try this edit script using a loop kind of thing

kkkumar82
Specialist III
Specialist III

For acheiving this does it require to sort the products in order , what I observed