I am working from a PostgreSQL db that has several tables including Orders and Customers. I do most of my analysis in Tableau and while possible (I think), it would be MUCH easier if I could bring the data into Tableau with a few new fields already calculated.
Specifically would like to
- add a field to the Customers table counting how many orders that customer has made as of today(), and
- add a field to Orders that tells how many orders the associated customer has made as of the current row order date (essentially an 'Nth order' by customer count).
The end goal is to run analyses on new v. returning customers, and characteristics about orders based on being the customer's 1st order, 5th order, etc..
My idea was to generate the fields and write calculations to populate them before connecting with Tableau. I don't have much experience with SQL, so trying to understand what my options are to achieve this. Any suggestions?