How to link a field value to a column name using template variables

Hello,

I have the attached.

So I have field values coming from telegraf, they are in pairs (tx1 and tx1n, tx2 and tx2n etc) tx1 is a string/name and tx1n is the associated number.
I am trying to get the tx1 name value to be displayed at the bottom of each column which is the tx1n value.
Is there a way of filling the column name with the tx1 value using ALIAS BY or the Display Name field on the right hand side column with a variable value? Using $ to get a value always results in that being displayed as the string itself? I don’t want to create a new query for tx1 as this creates a new column in the table.

Thank you very much

Hi @tj26,

Check out this public dashboard. It is a good example of how to use template variables:

Check out the dashboard settings and see how the variable are configured. Then, edit a query and change the panel title to include a template variable, like $server:

click apply and then observe the new behavior:

CleanShot 2021-09-29 at 11.58.43

Thanks for response Matt, I know how to change the panel title using templates, it is the column names tx1, tx2 etc that I am looking to change so the column name would be ABC because variable tx1=ABC, perhaps using templates is not how to do it? Variables somehow, but not sure how to link tx1 to tx1n?
so tx1n=10, tx1=ABC so column 1 would show 10 at the top as it currently does and ABC underneath as it doesn’t…
cheers.