I have a source file with comma separated fields, I have to create a table where I need combine and show statistics of different products.
Data file fields - TeamName,EmploymentType,Skills,TrainingCompleted
Source File data:
TeamA,Contract,Java,Yes
TeamA,Contract,DotNet,No
TeamA,Contract,C++,Yes
TeamA,Contract,ReactJS,No
TeamB,Permanent,Java,Yes
TeamB,Permanent,DotNet,No
TeamB,Permanent,C++,Yes
TeamB,Permanent,ReactJS,No
TeamC,Contract,Java,Yes
TeamC,Contract,DotNet,No
TeamC,Contract,C++,Yes
TeamC,Contract,ReactJS,No
TeamD,Permanent,Java,Yes
TeamD,Permanent,DotNet,No
TeamD,Permanent,C,Yes
TeamD,Permanent,ReactJS,No
TeamE,Contract,Java,Yes
TeamE,Contract,DotNet,No
TeamE,Contract,Java,Yes
Now the requirement is to create a table view of source file with below columns:
TeamName | EmploymentType | Skills | TrainingCompleted | Team Appearance | Training Completion% |
TeamA | Contract | Java,DotNet,ReactJS,C++ | 2 | 4 | 50% |
TeamB | Permanent | Java,DotNet,ReactJS,C++ | 2 | 4 | 50% |
TeamC | Contract | Java,DotNet,ReactJS,C++ | 2 | 4 | 50% |
TeamD | Permanent | Java,DotNet,ReactJS,C | 2 | 4 | 50% |
TeamE | Contract | Java,Dotnet | 2 | 3 | 67% |
Please give me the exact query. I am beginner in Splunk.
| stats values(Skills) as Skills count(eval(TrainingCompleted=="Yes")) as TrainingCompleted count as "Team Appearance" by TeamName EmploymentType
| eval Skills=mvjoin(Skills,",")
| eval "TrainingCompleted%"=round(100*TrainingCompleted/'Team Appearance',0)."%"
Thank you @ITWhisperer Can you also help me on how I can add another column "Previous week Training Completion%"
So that I can compare what is the progress from previous week to present week Training completion.
That is a different question, given that you don't appear to have any dates in your dataset.
@ITWhisperer Yes that's right. Once in a week the the progress data file will be pushed to Splunk. So how can we compare previous week and this week data for Training completion percentage?
So that i know the progress from the last week to this week.
I can post a new question if needed 🙂
| stats values(Skills) as Skills count(eval(TrainingCompleted=="Yes")) as TrainingCompleted count as "Team Appearance" by TeamName EmploymentType
| eval Skills=mvjoin(Skills,",")
| eval "TrainingCompleted%"=round(100*TrainingCompleted/'Team Appearance',0)."%"