Is it possible to set a condition in Rollup analysis like...?
SUM (or count) all values of Attribute1 if Attribute2=”Some value”
So it is possible to do this using the approach that I previously mentioned, but with a slight caveat. Assuming that Attribute2 is a string value representing the product name, you can't perform string comparisons in the Formula DR (such as Product=="Gasoline"). The way to work around that would be to use an Enumeration Set, and then perform your comparison against the numeric value of the enumeration. Or alternatively, you could use a simple table lookup to assign a numeric value to each product type, and define an attribute to display that numeric value based on the product currently stored in the vessel. Depending on how your Attribute2 is defined and populated with values, this might be a good alternative.
This raises another question - will these product values change from time to time, or are they constant for each storage vessel? For example, does the product stored in RTA001 ever change, or is it always the same product? My reason for asking is that if the product never changes, then you could look at using Element categories based on the product as the filter for your rollup. If a vessel can hold different products at different times then such use of Categories wouldn't work.
You're not able to apply conditions to directly to rollups; however, you can create an additional expression analysis that accepts the rollup-output as an input, then, applies a condition. So, in this scenario, the rollup is writing a sum to an output tag, then, in a separate analysis, the expression is only outputting the Sum when certain criteria are met.
Hope this helps!
Are your Attribute 1 values in a collection of child Elements, or are they in the same Element as the rollup? Likewise, where is Attribute 2 (your filter condition) located in relation to Attribute 1?
If everything is located in a single Element, or if Attribute 2 is located in the same Element as the rollup, then Anthony Malone's approach would work well. If Attribute 1 is located in a set of child Elements, and likewise Attribute 2 is also in those children, then you could use a simple Formula DR to 'wrap' Attribute 1 with the condition:
If Attribute2 == 'SomeValue' Then Attribute1 Else 0
You would then rollup the attribute configured with the Formula DR giving you your conditional rollup.
Attributes1 and Attribute2 are in child elements.
In my case, I want to calculate using rollup (in Tank element) amount of product in storages (Attribute1) if product has the same name (Attribute2).
Example: Calculate the total amount of all products that are called "Gasoline" in all tanks.
I have been thinking about mentioned options, and apparently no other way.
In storages are mostly the same products, but occasionally they can be changed.
This is a good idea to improve rollup calculation.
Retrieving data ...