Getting Data In

How to change week to time format?

hagar71
Explorer

hello everyone,

I have a column which contains week1 , week2 ,week3,week4,week5 and I want an input to the chart to show me the data from week1 to week3 for example or week2 to week5 how could I do that? 

Labels (3)
0 Karma

bowesmana
SplunkTrust
SplunkTrust

If you want a filter to only show weekX to weekY in your chart, you can use one or two text input boxes do define start/end week numbers. Let's assume you have 2 inputs, with the tokens tok_week_start and tok_week_end, then in your search you can finish the search with something like this

... your chart building search ...
| rex field=week_column "week(?<week_no>\s+)"
| where week_no>=$tok_week_start$ AND week_no<=$tok_week_end$
| fields - week_no

 

0 Karma

bowesmana
SplunkTrust
SplunkTrust

You can of course do this with a time picker input, but that will not be a week based approach.

I assume you were talking about a dashboard and my comments were related to the classic dashboard use of tokens.

0 Karma

hagar71
Explorer

@bowesmana 

I tried 

| rex field=Date "week(?<week_no>\s+)"
| where week_no>="week1" AND week_no<="week5"
| fields - week_no

but No results found the column of the weeks called Date 

0 Karma

bowesmana
SplunkTrust
SplunkTrust

Should be

| rex field=Date "week\s?(?<week_no>\d+)"
| where week_no>=1 AND week_no<=5
| fields - week_no

regex was wrong in my first example.

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

What Is Splunk? Here’s What You Can Do with Splunk

Hey Splunk Community, we know you know Splunk. You likely leverage its unparalleled ability to ingest, index, ...

Level Up Your .conf25: Splunk Arcade Comes to Boston

With .conf25 right around the corner in Boston, there’s a lot to look forward to — inspiring keynotes, ...

Manual Instrumentation with Splunk Observability Cloud: How to Instrument Frontend ...

Although it might seem daunting, as we’ve seen in this series, manual instrumentation can be straightforward ...