Combining data from two queries in dashboard

I have a single query which returns the following columns (month, A, B, cost). Columns A and B are basically categorical values which I group on. However, in this case I have a problem if I try to visualize the data as the charts will not sum the values (ref).

So I split the query into two separate ones and create a dashboard, however I want to also view the table containing the entire data, i.e, (month, A, B, cost).

What is the best way to go about doing this?

  • Create another query with both the columns present?
  • Create a view before executing any of the queries and then drop it at the end?
  • Something else

Thank you for your time!

Your first choice is always an option. Alternatively you could use window functions (using the OVER keyword) to perform the aggregation alongside the complete categorical data.

1 Like