Dynamically changing units

It is Config from query results, not Config from dashboard variable => you have to make query, which will use that variable first and returns values, which then will be used in that transformation. How to make that query is different question, but you need to be creative (save it in Prometheus, DBs, CSV test data, …). Don’t expect that everything will be straighforward - you will need more steps to achieve desired result.