Table name with dynamic values

Hi! I am trying to make a dashboard from SQL queries but I want the table name to contain a value that is dynamic. For example, I use this query:
FROM analytics_<id>.table
and I want to be able to select the value dynamically. Is there any way I can do this with a parameter or some other solution?
Thank you very much for your time!

Could you use a table valued function? Available in Postgres and MS SQL. Not sure about other DBs.