How to download visualization (Pivot view) or save view as new table

Hi,
I have generated a Table Visualization from my data, and pivoted it using one column to generate a view,

Screenshot of Pivoting
image

Generated Table

Issue

  • Unable to export the pivoted table view
  • Cannot save the view as a new table

How can I either export/save this as a new table to do additional analysis, keeping this as the base view?

Thanks!

1 Like

Hi @slushee

  1. Metabase currently only exports the plain table instead of the pivoted:
    https://github.com/metabase/metabase/issues/2473 - upvote by clicking :+1: on the first post
  2. I don't understand. The pivoted table is only done visually, the underlying data is not transposed. If you need something like that, then you should do that in SQL, if you need to results to be changed.

Thanks!

  1. Done!
  2. What I meant to ask was, what way to do the same in PSQL?
    The query I am currently using is:

SELECT "public"."quizlodata"."studentid" AS "studentid", "public"."quizlodata"."lo" AS "lo", avg("public"."quizlodata"."score") AS "avg"
FROM "public"."quizlodata"
GROUP BY "public"."quizlodata"."studentid", "public"."quizlodata"."lo"
ORDER BY "public"."quizlodata"."studentid" ASC, "public"."quizlodata"."lo" ASC

My requirement is to have "studentid" as column 1 for each row, pivot the table using "lo" and have "avg" as the values in the cells.

Thanks again!

@slushee Try creating a View on your database. And have a look at this:
https://stackoverflow.com/questions/23060256/postgres-transpose-rows-to-columns