How to add a week start date into a dashboard title

  • What Grafana version and what operating system are you using?

I have a dashboard (my first) that I’ve created in Grafana which is a list based report pulling from a SQL query however, I need to include a variable in the title for the dashboard.

Basically the listing is details of transactions within a week, and in the title I’m wanting to show the week commencing date the transactions relate to. I have a SQL query that can ascertain the date as a result to be able to use, but I have no idea how I can use this in the dashboard to include in the title.

In the “Panel Options” I can add in a “Title” that shows above the dashboard itself however, this looks to only be for static text so I’m a little stuck.

Any ideas (if it’s even possible) as to how I add in a date selected from another query as part of this title?

Generally, panel titles support dashboard variables, so just use soma panel as your dashboard title, e. g. My panel: $variable. You may try ti use it also in dashboard title, but IMHO that’s not supported.

1 Like

Hi Jan,

Thanks for the feedback, I’m presuming that the use of the $ symbol indicates to Grafana I’m referencing a variable however, I’ve tried this but it just shows as literal text (i.e. $myvarname) in the title :frowning:

Is there something I’m not doing right?

Thanks

No. That indicates that dashboard variable is not supported there.

Please share the query used for that variable? and how many results does it return?

Hi Jan,

For some reason looks like the variable hadn’t saved into the dashboard when I looked into it further, so it’s now showing the date in the title just as I need! :blush:

Thanks for the pointers!

Here’s the query I used to get the date I need, and yes, it only returned a single result

SELECT FORMAT(DATEADD(DAY, 8 - DATEPART(WEEKDAY, GETDATE()), GETDATE()), ‘dd/MM/yyyy’, ‘en-us’)

Managed to get this working now, but thanks for jumping in to help!

1 Like

I’ve created a dashboard with a list-based report pulling data from a SQL query, specifically detailing transactions within a given week. Now, I want to include the week commencing date dynamically in the dashboard title. I’ve managed to obtain this date using a SQL query, but I’m unsure how to incorporate it into the dashboard title dynamically.