Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
VolkanKu
Contributor III
Contributor III

How to aggregate data filtered by a column including the values of another based on a selection?

Hello,

I have a formula like below and it worked until i needed another filter for my analysis.

sum({<[B]={1}>} [C]) 

The data is formed by joining tables and the simplified end result is something like this;

A (Table X)B (Table X)C (Table Y)D (Table Z)
M003-0111C010-013
M003-01185.9394C010-013
M003-01144.3008C010-013
M003-01185.9394C010-013
Q005-0218.7291C010-013
Q005-03110C010-013
Q005-03110C010-013
M003-03150.2079C010-015
M003-03173.9857C010-015
M003-0311C010-015
M003-03173.9857C010-015
Q005-02153.6805C010-015
Q005-02153.6805C010-015
Q005-02088.8944 
Q005-02088.8944 
Q005-03088.8944 
M003-01018.0658 
M003-03021.4971 
M003-03021.4971 

 

What i am trying, and failing, to do is getting the sum of all C while B = 1 and any A row when D is selected.

IF "C010-013" at D is selected then the rows to calculate would be;

ABCD
M003-0111C010-013
M003-01185.9394C010-013
M003-01144.3008C010-013
M003-01185.9394C010-013
Q005-0218.7291C010-013
Q005-03110C010-013
Q005-03110C010-013
Q005-02153.6805C010-015
Q005-02153.6805C010-015
Q005-02188.8944 
Q005-03188.8944 
M003-01118.0658 

 

And the sum result would be;

ABCD
M003-011235.2454C010-013
Q005-021204.9845C010-013
Q005-031108.8944C010-013

 

It would be best if there is a way to get this result without changing the LOAD script for the data table. 

3 Replies
VolkanKu
Contributor III
Contributor III
Author

Anyone? 😱

Vegar
MVP
MVP

Try to solve this using P() in your set. Something like this.

sum({<[B]={"1"}, [A] =P({<[D] ='$(=only([D] )) '>} ) >} [C])

VolkanKu
Contributor III
Contributor III
Author

Hello,

Thanks for the reply but unfortunately i am getting "The selection generated no data for this chart" whether i select any D or not.