Script examples
Below you find some examples of scripted definitions.
The following examples of constants, filters, and multiple aggregations are based on this data.
Product | Color | Activity | Production costs (in €) | Shipping costs (in €) |
|---|---|---|---|---|
Product A | Red | |||
Activity A | 1000 | 50 | ||
Activity B | 2000 | 40 | ||
Activity C | 3000 | 30 | ||
Product B | Green | |||
Activity A | 500 | 20 | ||
Activity B | 800 | 40 |
Constants
The script converts the production costs from € to $.
The script totals the values in the Production costs column and multiplies the sum by the conversion factor of 1.08.
Tip
You can also use a variable to insert the conversion rate.
SUM("_ARIS.Activity"."Production costs") * 1.08
Result |
|---|
7884 |
Filters
The script calculates the production cost of Activity B per product and converts the production cost from € to $.
SUM("_ARIS.Activity"."Costs", FILTER(VALUE_MATCHES("_ARIS.Activity"."Activity Name", 'Activity B'))) * 1.08
Product | Result |
|---|---|
Product A | 2160 |
Product B | 864 |
The script calculates the production cost of all activities that cost more than 1000€ per product.
SUM("_ARIS.Activity"."Costs", FILTER(VALUE_GREATER_THAN("_ARIS.Activity"."Costs", 1000)))
Product | Result |
|---|---|
Product A | 6000 |
Product B | 0 |
Calculate the cost of all cases that contain an activity with the name Activity C.
SUM("_ARIS.Activity"."Costs", FILTER(CASE_PASSES_THROUGH('Activity C')))
Result |
|---|
6000 |
Multiple aggregations
The script totals the production and shipping costs per product.
SUM("_ARIS.Activity"."Production Costs") + SUM("_ARIS.Activity"."Shipping Costs")
Product | Result |
|---|---|
Product A | 6120 |
Product B | 1360 |
Percentage share
The calculation is based on the following dimensions (product and color), measures (costs), and activities. You can find the complete examples in the chapter Display as percentage share.
Product | Color | Activity | Costs |
|---|---|---|---|
Product A | Red | ||
Activity A | 1000 | ||
Activity B | 2000 | ||
Activity C | 3000 | ||
Product A | Green | ||
Activity A | 500 | ||
Activity B | 800 | ||
Product B | Red | ||
Activity A | 4000 | ||
Activity B | 6000 | ||
Activity C | 8000 | ||
Product C | Yellow | ||
Activity A | 1000 | ||
Product C | Yellow | ||
Activity A | 1500 | ||
Activity B | 1200 |
The script calculates the percentage share of the total cost for the various products.
SUM("_ARIS.Activity"."Costs") / SUM("_ARIS.Activity"."Costs", ignoreDimensions)
Product | Result |
|---|---|
Product A | 25.17% |
Product B | 62.07% |
Product C | 12.76% |
Ignoring any filters, the script calculates the percentage share of the total cost for the various products.
SUM("_ARIS.Activity"."Costs", ignoreGlobalFilters) / SUM("_ARIS.Activity"."Costs", ignoreDimensions, ignoreGlobalFilters
The following table is filtered by Product = 'Product A' AND Color = 'Green'
Product | SUM (costs) | Result |
|---|---|---|
Product A | 1300 | 25.17% |
The script calculates the current goal accomplishment for the products of a certain type and color if two products of different types with the same color, are the 100% goal.
SUM("_ARIS.Case"."Number of cases") / 2
Product | Color | Result |
|---|---|---|
Product A | Red | 50% |
Product A | Green | 50% |
Product B | Red | 50% |
Product C | Yellow | 100% |
Ratio
The calculation is based on the following criteria. You can find the complete examples in the chapter Configure the ratio aggregation.
Case | Problem type | Priority | Severity |
|---|---|---|---|
Case A | P1 | 1 | High |
Case B | P1 | 3 | High |
Case C | P2 | 3 | Medium |
Case D | 1 | ||
Case E | P3 | 3 | High |
Case F | P3 | 3 | High |
The script calculates the ratio of cases of problem type P1 in relation to all cases.
CT("_ARIS.Case"."Number of cases", FILTER(VALUE_MATCHES("_ARIS.Case"."Problem type", 'P1')) / CT("_ARIS.Case"."Number of cases")
Result |
|---|
33.33% |
The script calculates the ratio of cases for which no problem exists in relation to all cases.
CT("_ARIS.Case"."Number of cases", FILTER(VALUE_MATCHES("_ARIS.Case"."Problem type", NULL_TEXT)) / CT("_ARIS.Case"."Number of cases")
Result |
|---|
16.67% |
The script calculates the ratio of cases of problem type P3 in relation to all cases for which a problem exists.
CT("_ARIS.Case"."Problem type", FILTER(VALUE_MATCHES("_ARIS.Case"."Problem type", 'P3')) / CT("_ARIS.Case"."Problem type")
Result |
|---|
40% |
For the various combinations of the Problem type and Priority dimensions, the script calculates the ratio of cases to which the severity High applies in relation to the other cases.
CT("_ARIS.Activity"."Number of activities", FILTER(VALUE_MATCHES("_ARIS.Case"."Severity", 'High')) / CT("_ARIS.Activity"."Number of activities")
Problem type | Priority | Result |
|---|---|---|
P1 | 1 | 100% |
P1 | 3 | 100% |
P2 | 3 | 0% |
P3 | 3 | 50% |
- | 1 | 0% |