Handle Pivot with SQL

Hi guys. I'm pretty new with Metabase I read this topic: Visualizing native query question to pivot table is not working

I have a similar issue I need to show one Query in Pivot.

  1. Can I use Views (but how can I pass parameter?).
  2. So that means you create an SQL question without doing aggregation, so it just returns plain rows, and then you use that question as a starting point in the Simple/Custom question, where you then add you aggregation

How can I use a simple question to start point to make complex/custom question?

Hi @lucas.dj
Have a look here: Pass a filter to the original query via bridge query

Hi @flamber Can I create a View and use it a Data ? I created a View and in SQL command I can use it but Pivot doesn't work with sql commands right?? I tried to search my view after click in Admin > Database > myDB > Sync db schema and Re-scan field values and my view not showing on editor.

My Prod DB is SQL Server.

@Flamber I founded.
others developers using "v_ViewName" for views name. for any reason if I search for v_Metabase don't show nothing. If I search only for metabase shows "V Metabase" I'm not so sure if it's a bug into metabase or not.

@lucas.dj You cannot pass-thru variables to nested queries, so you can use SQL if you want, but without variables, and then use that SQL question as the base.

Have a look here if you cannot find Views: https://www.metabase.com/docs/latest/troubleshooting-guide/cant-see-tables

Disable friendly names if you don't want those: https://www.metabase.com/docs/latest/configuring-metabase/settings#friendly-table-and-field-names

1 Like

thank you so much @flamber