Splunk Search

How to display timechart multivalues without colon?

LearningGuy
Builder

Hello,

I have a set of Grade (Math, English, Science) data for Student1 and Student2 from 2/8/2024  to 3/1/2024
How to display timechart multivalues without colon?

The complete search is down below.   Thank you so much for your help.

This is the result with colon

LearningGuy_0-1709674799771.png

Is it possible to display the data like the following? 
Should I parse the data to get the display like below or is there a better way to do this?

StudentGrades2/8/20242/15/20242/22/20242/29/2024
Student1EnglishGrade107710
Student1MathGrade107710
Student1ScienceGrade107710
Student2EnglishGrade9679
Student2MathGrade9679
Student2ScienceGrade9679


Here's the search

 

| makeresults format=csv data="_time,Student,MathGrade,EnglishGrade,ScienceGrade
1707368400,Student1,10,10,10
1707454800,Student1,9,9,9
1707541200,Student1,8,8,8
1707627600,Student1,7,7,7
1707714000,Student1,6,6,6
1707800400,Student1,5,5,5
1707886800,Student1,6,6,6
1707973200,Student1,7,7,7
1708059600,Student1,8,8,8
1708146000,Student1,9,9,9
1708232400,Student1,10,10,10
1708318800,Student1,10,10,10
1708405200,Student1,9,9,9
1708491600,Student1,8,8,8
1708578000,Student1,7,7,7
1708664400,Student1,6,6,6
1708750800,Student1,5,5,5
1708837200,Student1,6,6,6
1708923600,Student1,7,7,7
1709010000,Student1,8,8,8
1709096400,Student1,9,9,9
1709182800,Student1,10,10,10
1709269200,Student1,10,10,10
1707368400,Student2,9,9,9
1707454800,Student2,5,5,5
1707541200,Student2,6,6,6
1707627600,Student2,7,7,7
1707714000,Student2,8,8,8
1707800400,Student2,9,9,9
1707886800,Student2,5,5,5
1707973200,Student2,6,6,6
1708059600,Student2,7,7,7
1708146000,Student2,8,8,8
1708232400,Student2,9,9,9
1708318800,Student2,9,9,9
1708405200,Student2,5,5,5
1708491600,Student2,6,6,6
1708578000,Student2,7,7,7
1708664400,Student2,8,8,8
1708750800,Student2,9,9,9
1708837200,Student2,5,5,5
1708923600,Student2,6,6,6
1709010000,Student2,7,7,7
1709096400,Student2,8,8,8
1709182800,Student2,9,9,9
1709269200,Student2,9,9,9"
| table _time, Student, MathGrade, EnglishGrade, ScienceGrade
| timechart span=1w first(MathGrade) as MathGrade, first(EnglishGrade) as EnglishGrade, first(ScienceGrade) as ScienceGrade by Student useother=f limit=0
| eval _time = strftime(_time,"%m/%d/%Y")   
| fields - _span _spandays
| transpose 0 header_field=_time  column_name=Grades

 

 

Labels (2)
0 Karma
1 Solution

yuanliu
SplunkTrust
SplunkTrust

Again, thank you for including data emulation in problem presentation.  I tried to be more semantic but the syntax got more and more tangled.  So this time, I will just use string manipulation.

 

| timechart span=1w@w first(MathGrade) as MathGrade, first(EnglishGrade) as EnglishGrade, first(ScienceGrade) as ScienceGrade by Student useother=f limit=0
| eval _time = strftime(_time,"%m/%d/%Y")   
| fields - _span _spandays
| transpose 0 header_field=_time  column_name=Grade
| eval Grade = split(Grade, ": ")
| eval Student = mvindex(Grade, 1), Grade = mvindex(Grade, 0)
| table Student Grade *
| sort Student

 

Here, I included snap-to  @w which you asked about in the other question.  Your emulated data gives

StudentGrade02/04/202402/11/202402/18/202402/25/2024
Student1EnglishGrade106107
Student1MathGrade106107
Student1ScienceGrade106107
Student2EnglishGrade9896
Student2MathGrade9896
Student2ScienceGrade9896

Hope this helps.

View solution in original post

Tags (2)

LearningGuy
Builder

Hello @yuanliu,
I tried your suggestion and modified column name "Grades" into "Grade", and it worked fine. I accepted your solution
So, we had to split the data manually.      Note that there is still an issue with snap-to is shifting the data as discussed in my other post.
I appreciate your assistance. Thank you

0 Karma

yuanliu
SplunkTrust
SplunkTrust

Again, thank you for including data emulation in problem presentation.  I tried to be more semantic but the syntax got more and more tangled.  So this time, I will just use string manipulation.

 

| timechart span=1w@w first(MathGrade) as MathGrade, first(EnglishGrade) as EnglishGrade, first(ScienceGrade) as ScienceGrade by Student useother=f limit=0
| eval _time = strftime(_time,"%m/%d/%Y")   
| fields - _span _spandays
| transpose 0 header_field=_time  column_name=Grade
| eval Grade = split(Grade, ": ")
| eval Student = mvindex(Grade, 1), Grade = mvindex(Grade, 0)
| table Student Grade *
| sort Student

 

Here, I included snap-to  @w which you asked about in the other question.  Your emulated data gives

StudentGrade02/04/202402/11/202402/18/202402/25/2024
Student1EnglishGrade106107
Student1MathGrade106107
Student1ScienceGrade106107
Student2EnglishGrade9896
Student2MathGrade9896
Student2ScienceGrade9896

Hope this helps.

Tags (2)
Get Updates on the Splunk Community!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Get the T-shirt to Prove You Survived Splunk University Bootcamp

As if Splunk University, in Las Vegas, in-person, with three days of bootcamps and labs weren’t enough, now ...

Wondering How to Build Resiliency in the Cloud?

IT leaders are choosing Splunk Cloud as an ideal cloud transformation platform to drive business resilience,  ...