Skip to main content
Announcements
Document boards are being consolidated, this board no longer allows NEW documents READ MORE

Aggr() and set analysis: set modifiers inside and / or outside aggr()?!?

cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Aggr() and set analysis: set modifiers inside and / or outside aggr()?!?

Last Update:

Sep 21, 2022 5:11:51 PM

Updated By:

Sue_Macaluso

Created date:

Oct 17, 2017 4:50:59 PM

Attachments

Hi community,

"Where should the set modifier be placed? Inside and/or outside the aggr()?"

The standard answer is mostly:

"If you are unsure, you should place the set modifiers inside and outside the aggr(). This will probably lead to the desired result..."

I just can't agree. In my opinion it really, really! depends...

Example 1

sum(aggr(sum(F4),F1))

--> default case

sum(aggr(sum({<F2={"D","E"}>} F4),F1))

--> set modifier at inner aggregation limits F4 values

sum({<F2={"D","E"}>} Rangesum(F3,aggr(sum(F4),F1)))

--> set modifier at outer aggregation

--> no difference , because F1={A} exists for F2={D} and F1={B} exists for D2={E}


sum({<F2={"D"}>} aggr(sum(F4),F1))


--> set modifier at outer aggregation

--> F1={A} exists for F2={D} and F1={B} doesn‘t exist for D2={E}

sum({<F2={"D"}>} aggr(sum({<F2={"D"}>}F4),F1))


--> set modifier at inner and outer aggregation

--> F1={A} exists for F2={D} and F1={B} doesn‘t exist for D2={E}

--> set modifier at inner aggregation limits F4 values

Example 2

sum(Rangesum(F3,aggr(sum(F4),F1)))

--> default case

sum(Rangesum(F3,aggr(sum({<F2={"D","E"}>} F4),F1)))

--> set modifier at inner aggregation limits F4 values inside aggr()

--> but doesn’t limit F3 outside aggr()

sum({<F2={"D","E"}>} Rangesum(F3,aggr(sum(F4),F1)))


--> set modifier at outer aggregation limits only F3 field, because F1={A} exists for F2={D} and F1={B} exists for D2={E}

sum({<F2={"D"}>} Rangesum(F3,aggr(sum(F4),F1)))

--> set modifier at outer aggregation

--> limits F3 and F4, because F1={A} exists for F2={D} and F1={B} doesn‘t exist for D2={E}

sum({<F2={"D"}>} Rangesum(F3,aggr(sum({<F2={"D"}>} F4),F1)))

--> set modifier at inner and outer aggregation limts F3 and F4 values

Regards

Robin

Tags (1)
Comments
cbsbrasil
Contributor
Contributor

My congratulations on the material. More didactic is impossible.

0 Likes
Andrei_Faibich
Contributor III
Contributor III

Great explanation!

There is a wrong expression in one example, it should be 

sum({<F2={"D","E"}>}aggr(sum( F4),F1)) instead I guess

Andrei_Faibich_0-1678353315064.png

 

0 Likes
Contributors
Version history
Last update:
‎2022-09-21 05:11 PM
Updated by: