Splunk Search

How to aggregate across columns?

cheung_bea
Engager

So I currently have a csv table of users and click events related to purchases on an app. The table goes something like this:

userId | timestamp | uxID | buyId | price
1004 5/26/2016 3:36:54 PM 6004 2 5
1300 5/26/2016 5:06:54 PM 6005 1 10
1027 5/26/2016 6:06:54 PM 6006 3 3
...

The buyId is the number of the specific item that users can purchase and there are six items available in total. The price for the different items vary as well. What I want to know is:

1) how much money was spent in total for each item?
2) the total amount of money spent by the top ten users (ranked by how much money they spent

Many thanks!

0 Karma
1 Solution

cmerriman
Super Champion

I think you'll need two separate searches.

...|stats sum(price)  as revenue by buyId

...|stats sum(price) as revenue by userId|sort 0 - revenue |head 10

View solution in original post

cmerriman
Super Champion

I think you'll need two separate searches.

...|stats sum(price)  as revenue by buyId

...|stats sum(price) as revenue by userId|sort 0 - revenue |head 10

cheung_bea
Engager

Thanks very much!

0 Karma
Get Updates on the Splunk Community!

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...

Splunk APM: New Product Features + Community Office Hours Recap!

Howdy Splunk Community! Over the past few months, we’ve had a lot going on in the world of Splunk Application ...

Index This | Forward, I’m heavy; backward, I’m not. What am I?

April 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...