Splunk Search

How to convert multiples data field using xyseries and sort data Month wise?

Ashwini008
Builder

Hi,

My data is in below format

Ashwini008_0-1654523200616.png

I am trying to add the total of all the columns and show it as below

Ashwini008_1-1654523243482.png

Please help me on how can i achieve this and also i am trying to sort by rename 1 2 as JAN FEB so on but after renaming it is sorting by alphabetical order. How can i sort based on month wise?

Labels (3)
0 Karma
1 Solution

PickleRick
SplunkTrust
SplunkTrust

1. Use addttotals. Since you probably don't want totals column-wise, use col=false

2. At the end of your search (after rename and all calculations), add

| table CURRENCY Jan Feb [...] Total

 

View solution in original post

ITWhisperer
SplunkTrust
SplunkTrust

Depending on the number of rows you have, transpose might be another solution

| transpose 0 header_field=CURRENCY column_name=CURRENCY
| sort 0 CURRENCY
| eval CURRENCY=strftime(strptime("2022-".CURRENCY."-1","%Y-%m-%d"),"%b")
| transpose 0 header_field=CURRENCY column_name=CURRENCY
| addtotals col=f

PickleRick
SplunkTrust
SplunkTrust

1. Use addttotals. Since you probably don't want totals column-wise, use col=false

2. At the end of your search (after rename and all calculations), add

| table CURRENCY Jan Feb [...] Total

 

Ashwini008
Builder

@PickleRick Thank You, it worked fine.

Could you please help me with one more solution

I am appending the 3 results and now how do i add the total of 3 results.

Ashwini008_0-1654526811335.png

 

0 Karma

PickleRick
SplunkTrust
SplunkTrust

Now you do need the column-wise totals. So just do col=true (or don't specify it at all - true is the default setting if I remember correctly)

Get Updates on the Splunk Community!

How to Monitor Google Kubernetes Engine (GKE)

We’ve looked at how to integrate Kubernetes environments with Splunk Observability Cloud, but what about ...

Index This | How can you make 45 using only 4?

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

Splunk Education Goes to Washington | Splunk GovSummit 2024

If you’re in the Washington, D.C. area, this is your opportunity to take your career and Splunk skills to the ...