cancel
Showing results for 
Search instead for 
Did you mean: 

Average of Tags using SAP PCo Query

Former Member
0 Kudos

HI All,

I am using PCo_query and I need to average the tag values for each one hour for a day.

I have given the Duration as 1 hr in Query Template. How can I get the Average for each 1 hr.

Please let me know how to do it?

Regards

G.Partheeban

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member196557
Active Contributor
0 Kudos

Hi Partheeban,

For the PCoQuery, to get a one hour average for each of 24 hours in one day:

In the Date Range settings: set the Start Date and End Date for a 24 hour period.  if you just want the current 24 hour period ending with the current time, leave both empty and set the Duration value to 1 and Duration Units to Days. If you want a weeks worth of data, set Duration value to 7.

Then sTag Aggregate Query settings, chose the tag(s) to query and check Average from the Aggregates selections. then execute your query and you should get back 24 rows of one hour averages for each day in your date range.

Regards, Steve

Former Member
0 Kudos

Hi Steve,

Thanks... but I am not getting the output as you said.

My requirement is that passing Start Date and End Date.In that period I need to get average for different Time Intervals for every 1,6,8 and 24 hrs.

Please let me know how to do it with PCo Query.

Attached the configuration screen shot of mine. Please let me know where I am going wrong.

Regards

G.Partheeban

former_member196557
Active Contributor
0 Kudos

Hi,

After you set a Data Range, set the Interval Count to the number of rows the aggregate returns. For the Duration of 1 Day, setting Interval Count to 24 will return 24 rows of 1 hour Averages.

You will need to execute multiple queries with different interval counts for the same duration in order to get the results you want. So for a duration of 1 day or 24 hours:

Interval Count=24 -> 24 1-hour average rows

Interval Count=4 -> 4 6-hour average rows

Interval Count=3 -> 3 8-hour average rows

Interval Count=1 -> 1 24-hour average row.

In your case, since you are after hourly averages for multiple hours, I would recommend you set your Duration to 24 and then the duration/Interval Count = number of hours in each row returned. For multiple day intervals you will need to adjust the Interval count so that it still returns the number of hours in each interval over the Duration period.

Regards, Steve

Former Member
0 Kudos

Hi Partheeban,

Create a transaction and calculate and provide the start date to the Query from the transaction.

E.g.:

You need Average between 7 PM and 8 PM.

So provide 7 PM as QueryStartDate.

In PCo Query Object:

Mode: TagAggregateQuery

Duration: 1 hour

Regards,

Rohit Negi.