Dashboards & Visualizations

How to create a custom filter with months in the dashboard?

Drake_IT
Engager

I would like to create a time filter in my dashboard based on Month reports, something like below:

Drake_IT_0-1682523172031.png

But each month time frame should be customized on this way:

January -> Between 15/12/2022 (previous year) and 05/01/2023 (current year)

February -> Between 15/01/2023 and 05/02/2023

March -> Between 15/02/2023 and 05/03/2023

....

This should be used to filter the data presented on the dashboard based on the month selected.

Labels (1)
0 Karma
1 Solution

Drake_IT
Engager

Hi @gcusello ,

Thank you for your help. I was able to get to a solution on this way:

I created a dataset with the months and the range dates that I needed:

Drake_IT_0-1683026619410.png

Then using the dropdown created with the months that can be selected by the user I added a sub search to each panel on the dashboard using that as a filter (based on the token from the dropdown).

[search index=index_used | head 1 | fillnull value="" | eval month="$month_search$" | eval year=strftime(_time,"%Y") | lookup Months.csv Month as month OUTPUT Start_Date as RR_Start_Date, End_Date as RR_End_Date | eval latest=RR_End_Date.year | eval year=if(month="January", year - 1, year) | eval earliest=RR_Start_Date.year | eval earliest=strptime(earliest,"%m/%d/%Y") | eval latest=strptime(latest,"%m/%d/%Y") | table earliest, latest | format "" "" "" "" "" ""]

Regarding your question:

Then I don't understand how you manage the missing periods, e.g. from 06/01/2023 and 14/01/2023 -> On that period we don't have data that should be used on the report.

Thank you!

 

View solution in original post

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @Drake_IT,

this is possible creating a lookup containing at least three columns:

  • Month
  • StartTime
  • EndTime

Then you can use these column to associate the "Month" field to each event and then run a statistic.

Could you share some sample of your data?

Then I don't understand how you manage the missing periods, e.g. from 06/01/2023 and 14/01/2023.

Ciao.

Giuseppe

Drake_IT
Engager

Hi @gcusello ,

Thank you for your help. I was able to get to a solution on this way:

I created a dataset with the months and the range dates that I needed:

Drake_IT_0-1683026619410.png

Then using the dropdown created with the months that can be selected by the user I added a sub search to each panel on the dashboard using that as a filter (based on the token from the dropdown).

[search index=index_used | head 1 | fillnull value="" | eval month="$month_search$" | eval year=strftime(_time,"%Y") | lookup Months.csv Month as month OUTPUT Start_Date as RR_Start_Date, End_Date as RR_End_Date | eval latest=RR_End_Date.year | eval year=if(month="January", year - 1, year) | eval earliest=RR_Start_Date.year | eval earliest=strptime(earliest,"%m/%d/%Y") | eval latest=strptime(latest,"%m/%d/%Y") | table earliest, latest | format "" "" "" "" "" ""]

Regarding your question:

Then I don't understand how you manage the missing periods, e.g. from 06/01/2023 and 14/01/2023 -> On that period we don't have data that should be used on the report.

Thank you!

 

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @Drake_IT,

good for you, see next time!

Ciao and happy splunking

Giuseppe

P.S.: Karma Points are appreciated 😉

0 Karma
Get Updates on the Splunk Community!

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...