cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

Month-on-month growth with pivot

Vittorio
New Contributor II

I need to create pivot tables with data on revenue/costs presented monthly and I need to show the month on month growth and it seems like mission impossible with Dashboards on SQL warehouse despite being quite obviously a very typical task.

Pivot table visualization does not support any calculation with the values so despite working well as pivot tables, does not provide an opportunity to calculate growth.

Calculation of a pivot table with SQL and then creating the growth columns kinda works, but:

1. It has to be created manually for each month (and persistently updated)

2. In case of letting a user to choose the period, at best you can just show null columns for the months outside of the date range, but it is clearly not what users expect.

3. Certain fields e.g. date, or say region (that is not a row in pivot) has to be parametrized and those parameters do not work with filters applied on visualization (as based on a different datasets), despite "linked" with inputs.

1 REPLY 1

Brahmareddy
Honored Contributor III

Hi Vittorio,

How are you doing today? , As per my understanding, You're absolutely right—creating a proper pivot table with dynamic month-over-month (MoM) growth in Databricks SQL Dashboards is surprisingly tricky for such a common use case. The built-in pivot table visualizations are great for summarizing, but they don’t support calculated fields or expressions on pivoted values, which makes growth calculations almost impossible without workarounds. Writing MoM growth directly in SQL can work, but like you said, it becomes rigid—you’d need to update the logic manually every time the date range changes, and it doesn't play nicely with user inputs or filters. A more flexible approach would be to pre-calculate the pivot and growth metrics in a view or Delta table, then let the dashboard visualize just the cleaned output. Or, if interactivity and dynamic comparison are essential, using a BI tool like Power BI or Tableau on top of the Databricks SQL Warehouse may give you better control over pivot logic and user-driven filters. Hopefully, calculated fields in pivot visualizations become available in Databricks soon, but until then, building the logic outside the dashboard is often the most stable path. Let me know if you’d like help designing the SQL view for this use case!

Regards,

Brahma

Join Us as a Local Community Builder!

Passionate about hosting events and connecting people? Help us grow a vibrant local community—sign up today to get started!

Sign Up Now