Dashboards & Visualizations

How to get the calender week from the date?

anooshac
Communicator

Hi Everyone,

I want to plot a chart according to the calendar week. I plotted a timechart like this,

 

|timechart span=7d distinct_count(Task_num) as Tasks by STATUS

 

But this doesn't give the exact calendar weeks. Also i am keeping this charts data to last 3 months.

Anyone have idea how to plot a bar chart based on calendar week? instead of date i want to see the data for current calendar weeks of last 3 months.

I got from the splunk community on how to get the Calendar week. But i am not to plot a graph out of it.

| eval weeknum=strftime(strptime(yourdatefield,"%d-%m-%Y"),"%V")

 

 

Labels (3)
Tags (2)
0 Karma

isoutamo
SplunkTrust
SplunkTrust

Hi

maybe you could try to get data by adding this into your base search ?

earliest=-3mon@w+d latest=@w+d

 

0 Karma

richgalloway
SplunkTrust
SplunkTrust

Untested, but try the chart command.

| eval weeknum=strftime(strptime(yourdatefield,"%d-%m-%Y"),"%V")
| chart dc(Task_num) as Tasks over weeknum by STATUS

 

---
If this reply helps you, Karma would be appreciated.
0 Karma

anooshac
Communicator

Mt date field is _time. When i use this query i'm getting as no results found.

| eval weeknum=strftime(strptime(_time,"%d-%m-%Y"),"%V")
| chart dc(Task_num) as Tasks over weeknum by STATUS

 

0 Karma

richgalloway
SplunkTrust
SplunkTrust

_time is already in epoch form so it does not need to be (and cannot be) converted using strptime.

| eval weeknum=strftime(_time, "%V")
| chart dc(Task_num) as Tasks over weeknum by STATUS
---
If this reply helps you, Karma would be appreciated.
0 Karma

anooshac
Communicator

Thank you so much.. I totally forgot that it is already in epoch format.

0 Karma
Get Updates on the Splunk Community!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

Using the Splunk Threat Research Team’s Latest Security Content

REGISTER HERE Tech Talk | Security Edition Did you know the Splunk Threat Research Team regularly releases ...

SplunkTrust | 2024 SplunkTrust Application Period is Open!

It's that time again, folks! That's right, the application/nomination period for the 2024 SplunkTrust is ...