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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
agni_gold
Specialist III
Specialist III

Need Summation logic at set analysis

Hi Friends,

I have a situation  ,

Where i want to show only data for below condition

Negative MACO and Positive Vol , attaching my sample data also .

It is required to do this at frontend  level.

16 Replies
sunny_talwar

May be this:

Dimension

State

Expression

fabs(RangeSum(Sum({<Account = {'Vol'}, Value = {'>0'}>} Value), Sum({<Account = {'Maco'}, Value = {'<0'}>} Value)))

vinieme12
Champion III
Champion III

This will also work, but you will need a keyfield to identify each datarow

sum({< KEY  = p({<Account = {'Vol'} , Value = {"<0"}>}KEY)+p({<Account = {'Maco'} , Value = {">0"}>}KEY) >} Value)

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
agni_gold
Specialist III
Specialist III
Author

Hi Sunny  ,

result is

State Test
17
A3
B20

But i dont require B row , because it is not coming under my condition

Negative MACO and Positive Vol

vinieme12
Champion III
Champion III

Hi ,can you explain the calculation for why not B?

+Vol = 23

-Maco = 3 , so 20

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
agni_gold
Specialist III
Specialist III
Author

Hi ,

Initial Data

 

StateAccountValue
AVol10
BVol-2
BVol23
AVol-7
AMaco-1
AMaco-2
BMaco-3
AMaco-4
BMaco5
AMaco

-6

Aggregated data based on State Column

  

StateAccountValue
AVol3
BVol21
AMaco-13
BMaco2

Now if we check my condition based in State Column ,

Example : For State A , Negative Maco and Positive Volume , Condition is true , and for B  it is not  , so when i am showing Volume data in expression , only A should come.

vinieme12
Champion III
Champion III

OH K, Use

fabs(if(sum({<Account = {'Maco'}>}Value)<0, sum({<Account = {'Maco'},Value={'<0'} >}Value))

+

if(sum({<Account = {'Vol'}>}Value)>0, sum({<Account = {'Vol'},Value={'>0'} >}Value))

)

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
sunny_talwar

Another option (slightly modifiying Vineeth's above response)

fabs(Sum({<Account = {'Maco'},Value={'<0'}, State = {"=Sum({<Account = {'Maco'}>}Value)<0 and Sum({<Account = {'Vol'}>}Value)>0"}>}Value)

+

Sum({<Account = {'Vol'},Value={'>0'}, State = {"=Sum({<Account = {'Maco'}>}Value)<0 and Sum({<Account = {'Vol'}>}Value)>0"}>}Value))