Reuse/share question result across dashboard cards

For example, I have three scalar cards in my dashboard, each displaying specific items via the Visualization options.

  • User Count,
  • Total income
  • User Average ( Total income / User Count)

These three values come from a single saved query. However, when the dashboard loads, it triggers the query three times. Can it be loaded once and shared among the three cards?

Not possible. Since each card/question in metabase is it's own query

In my case, there is only ONE card/question. The query result has three values, shown in three separate dash-cards. I compared the /api/dashboard/{dashboard_id}/dashcard/{dashcard_id}/card/{card_id}/query responses and found differences only in the visualization settings.

Can this be done in the frontend to load once and render three times based on the visualization settings? The query results are the same for each instance.

In that case you can use question caching

Metabase will always fire a query since a card on a dashboard will have its own using dashcard ID ... but if you are saying the question isn't changing then the contents should get cached and the query should load from the cache

OK, thanks for your advice. Caching is good, but it does not suit my needs.

I do not have too many users and requests in the corporation. If the dashboard triggers 3 queries at the same time and each takes 1 second to return, the cache hit rate could be very low. If set a long cache TTL, it will be another problem.

Yeah i understand but until this gets implemented

There isn't much the application can do apart form the cache hack

Got it, thanks!

1 Like