Splunk Search

How to multiply the x-axis values by the y-axis values and display the result on the y-axis in the chart?

nitro345
New Member

I got a project where I have a csv file with one particular field. Each bar ranges from 200-700 in value. I need to be able to multiply the values in the x-axis by the numbers on the y-axis and put the resultant number on the y-axis.

0 Karma

lguinn2
Legend

Based on your description, this should work, although you still didn't give any field names or show your search. For my example, I will assume that the field name in the csv file is "Number." You will have to fill in the search, it is probably something like "source=myfile.csv"

yoursearchhere
| chart count by Number
| eval count=count*Number

Pick the visualization that you like to show the results: bar chart or column chart will probably work well.

lguinn2
Legend

As others have said, we need more information. Clearly the list of sample data didn't help us to help you.
You talk about the X-axis and Y-axis - what do you mean by that?

If you could simply show the Splunk commands that you are using, and possibly a few lines from the Statistics tab (if you have any results to show), I am sure the community could help quickly and easily.
If you don't have anything else, at least run a search and use the | table command to list the fields of interest.

0 Karma

somesoni2
SplunkTrust
SplunkTrust

It's really difficult to provide any suggestion without proper sample data. Also, is the data indexed in Splunk OR added as lookup table files (since this is CSV)?

Generally, If you've a search generating two columns X and Y, and if you want to calculate another Value as X*Y to be plotted in y-axis, then we do like this

your current search giving field X and Y | eval Z=X*Y | table X Y Z

Use chart visualizations like line/column/bar/area chart.

0 Karma

somesoni2
SplunkTrust
SplunkTrust

Based on your new comment , try this

Your current search giving data with field X | stats count by X | eval Y=count*X

0 Karma

sundareshr
Legend

Please share some sample data

0 Karma

nitro345
New Member
3
10
20
3
20
20
20
3
20
2
10
5
20
5
1
1
20
3
2
1
3
2
2
5
3
20
5
20
3
5
20
1
3
0 Karma

nitro345
New Member

here is the data. i need to chart out the numbers on the x axis and the number of times each value occurs times the value itself. example 20 occurs 10 times y axis will be 20*10

0 Karma

ppablo
Retired

Hi @nitro345

If you're sharing sample data, please be sure to highlight all of it and click the "Code Sample" button in the text editing tools to make sure special characters render properly.

0 Karma

sundareshr
Legend

The format doesn't seem right. This appears to be all in one column. Please post it as an image

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

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

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...