Seeq Team Shamus Cunningham Posted June 18, 2021 Seeq Team Share Posted June 18, 2021 This question came in through the support channel today and I thought it was a good opportunity to explain some of the nuances in the Scorecard tool and give a couple of potential work arounds. Question: Quote I have two rows in my Scorecard table and I want to do some math on the metrics to create a third row. The calculation is (Stage 2 Duration / Running Duration) * 100 to calculate what % of total running time we were in the Stage 2 mode. In this example we are using two simple Value Searches on the Example -> Area A dataset Running -> Compressor Stage !~ "off" Stage 2 Running -> Compressor Stage ~ "stage 2" Unfortunately in Seeq there is not an easy way to directly perform Math or formula like operations on Scorecard Metrics created using the "Simple" option like you see here above. The "Simple" metrics are reactive to your display range and so have more limitations as compared to the "Condition" and "Continuous" options. In order to create this calculation we need to first decide on a calculation range that matches our engineering or business need. In this case we want to calculate this value per month. Option 1 - Convert to Signal from Condition Calculations Create a Monthly condition using the Periodic Condition tool Create Monthly Total duration in each mode calculations using the Signal from Condition Tool Use Formula to Create your % Time running calculation ($Stage2Duration/$RunningDuration).convertUnits("%") Create Scorecard using Condition Option Option 2 - Create Continuous Calculation Signal The main downside of Option 1 is that you cant see at any given point in time how the last running 30 days have been performing like you could with the original simple scorecard metrics. The following formula will build a calculation of the % Time in Stage 2 of total running time for the trailing 30 days calculated every hour $aggPeriods = periods(30days,1h) $RunningDuration = $Running.removeLongerThan(1d).aggregate(totalduration(),$aggPeriods,endkey()) $stage2Duration = $Stage2Running.removeLongerThan(1d).aggregate(totalduration(),$aggPeriods,endkey()) ($stage2Duration/$RunningDuration).convertUnits("%") This calculation can be added in a simple scorecard metric as well and as long as the simple scorecard duration is 30 days it will give you the desired results. 1 Link to comment Share on other sites More sharing options...

## Recommended Posts

## Create an account or sign in to comment

You need to be a member in order to leave a comment

## Create an account

Sign up for a new account in our community. It's easy!

Register a new account## Sign in

Already have an account? Sign in here.

Sign In Now