Jump to content

Recommended Posts

  • Seeq Team

FAQ:

For reporting purposes, I want to calculate statistics based on the current period to date and display that next to the periods immediately preceding it. This is easy to do using the custom date range tool in Organizer Topic (Creating a Periodic Condition and the grabbing the capsule closest to or offset by 1 from the end). Is there a way to create these same date ranges relevant to the current time in Seeq Workbench?

image.png

 

Solution:

We can create identical conditions in Seeq Workbench by following the methods below. The first method defines how to create conditions for current and previous conditions for years, days, weeks, shifts. The second method includes an extra step that is necessary for current and previous months and quarters since the exact duration of these periods can vary based on the number of days each month. 

Method 1 - when the length of time in each period is definitive (e.g. year, week, day, shift). This example shows how to create conditions for "Current Week" and "Previous Week"

1. Create a Periodic Condition for "Weekly" using the Periodic Condition tool. 

image.png

2. Create a Condition around the current time ("Now") using Formula --> 

condition(1min, 
          capsule(now() - 1min, now()))

image.png

3. Use the Composite Condition tool to create a condition for "Current Week" when the Periodic Condition "Weekly" touches the tiny capsule at "Now".

image.png

4. Use Formula to create a condition for the "Previous Week" --> 

$currentWeek.beforeStart(7d)

image.png

Method 2 - when the length of time in each period is variable (e.g. month, quarter). This example creates a condition for "Current Month" and "Previous Month"

1.  Create a Periodic Condition for "Monthly" using the Periodic Condition tool.

image.png

2. Create a Condition around the current time ("Now") using Formula --> 

condition(1min, 
          capsule(now() - 1min, now()))

image.png

3. Use the Composite Condition tool to create a condition for "Current Month" when the Periodic Condition "Monthly" touches the tiny capsule at "Now".

image.png

4. Use Formula to create a Condition for the last day of the last period (in this case "Last Day of the Last Month")

$currentMonth.beforeStart(1d)

image.png

5. Use the Composite Condition tool to create a condition for the "Previous Month" when the Periodic Condition "Monthly" touches the "Last Day of Last Month".

image.png

 

 

  • Like 2
Link to post
Share on other sites
  • 7 months later...

Thanks for the post, Allison!

I wanted to share how I took what you did and made it into rolling a "year to date" (YTD) metric, and other comparable metrics.

I work in hydroelectric generation, so my utility operates a few dams. One of the things we want to track is how close our upstream water level (headwater) gets to our buffered operating limits (in this case I'm looking at buffered lower limit dips). Here's a screenshot of the example scorecard metrics I created:

metrics.jpg.cb7b0cda2212c5a35b6eb2baa26bbd7c.jpg

And here are the dependency trees:

1910815330_dependencytree1.png.d7cc4e543035a64d923ebf77f562986f.png823550834_dependencytree2.png.888716ab374bd0072c04fff66741a8e1.png1808686730_dependencytree3.png.7f80f991688c89e12b3409cfd64b51c4.png

 

Here's how I did it:

So, starting from the deepest part of the trees:

  • ‘Yearly 1’ is common to all three. It is standard Periodic Condition for Yearly capsules.
  • ‘Now Condition’ follows the forum post. Make this formula: condition(1min, capsule((now()-1min), now()))
  • ‘Year Ago Now’ is based on the ‘Now Condition’ but you subtract off another year. Make this formula: condition(1min, capsule((now() - 1min - 1year), (now() - 1year)))

 

  • ‘Current Year’ is a composite condition of ‘Yearly 1’ and ‘Now Condition’ using “Touches”
  • ‘Last Year’ is a composite condition of ‘Yearly 1’ and ‘Year Ago Now’ using “Touches”
  • ‘Rolling Year Condition’ is a formula. condition(1year, capsule((now()-1year), now()))

 

  • ‘Year to Date’ is a composite condition of ‘Current Year’ and ‘Rolling Year Condition’ using “Intersection” (i.e. when is it both the current year and happening within the last year.)
  • ‘Last Year to Date’ is a composite condition ‘Last Year’ and ‘Rolling Year Condition’ using “A minus B” (i.e. when is it last year but not within the last rolling year.)

 

  • Then you can create your usual value based conditions. I used RI Headwater less than 610.

 

  • Then you create your metrics! Here’s the screenshot of the Year to Date metric. To get Last YTD, you simply change the condition at the bottom to ‘Last Year to Date.’ The metrics refresh when you refresh the screen!

670278168_metricscreenshot.png.31ad46be7f35ababa5a92901fae24766.png

 

  • Like 1
Link to post
Share on other sites

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
×
×
  • Create New...