Support Forum
The Forums are a place to find answers on a range of Fortinet products from peers and product experts.
shaneboy
New Contributor

How to show the sum or a field of the actual day and the sum of the same field of 30 days?

Hi, so I need to show something like this:

App  |     sum      |   Sum of the past 30 days

 

the querie would be something like this:

select app, sum(bandwidth), (sum(bandwidth)/30) from $log where to_timestamp(itime)::date BETWEEN (current_date) and (current_date-30)

 

That's just an example, maybe it's not even functional. But here's my question, with the where condition the querie would select the records between today and the actual date minus 30 days. So, the last column will collect those records, make the sum and divide the result.

But how I could select the records from today and just that ones to make the sum of the present day(2nd column).

 

I'm not sure if I'm being clear or something. If someone got the idea and knows what could I do, I'd aprecciate it and if someone needs a better explanation just let me know.

 

Regards.

0 REPLIES 0
Labels
Top Kudoed Authors