Dashboards & Visualizations

Display PREVIOUS Month and Year in Single Value Panel in Dashboard

aferone
Builder

In relation to this post:

https://answers.splunk.com/answers/209329/how-do-i-display-the-current-date-month-and-year-i.html

How would I display the PREVIOUS month on a dashboard? I have report panels that run for the previous month, and I want to show that month and year in a single value panel above each report.

Thanks!

0 Karma
1 Solution

somesoni2
Revered Legend

Try something like this for your single value panel search

| gentimes start=-1 | eval lastmonth=strftime(relative_time(now(),"-1mon"),"%b %Y") | table lastmonth

View solution in original post

somesoni2
Revered Legend

Try something like this for your single value panel search

| gentimes start=-1 | eval lastmonth=strftime(relative_time(now(),"-1mon"),"%b %Y") | table lastmonth

aferone
Builder

Thanks! This works! It just seems to take a long time to run for some reason.

0 Karma

sbhatnagar88
Path Finder

How can i display last 6 moths starting from the current.

Jan 2019
Dec 2018
Nov 2019
Oct 2018

0 Karma

1206chandra
Explorer

Hi sbhantnagr88

| gentimes start=-6 | eval lastmonth=strftime(relative_time(now(),"-6mon"),"%b %Y") | table lastmonth

0 Karma

somesoni2
Revered Legend

Strange. These (gentimes and now() both) are one of the fastest command I've seen (auto-generating command, doesn't access any index).

0 Karma

aferone
Builder

I added |head 1, and everything is just fine.

Thanks!

0 Karma
Get Updates on the Splunk Community!

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...

.conf24 | Registration Open!

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

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...