cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Warehousing & Analytics
Engage in discussions on data warehousing, analytics, and BI solutions within the Databricks Community. Share insights, tips, and best practices for leveraging data for informed decision-making.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

custom calculation of percentage of total and cumulative percentage

genebaldorios
New Contributor

Is there a way to calculate the percentage of total using the Databricks dashboard's custom calculations and also the cumulative percentage? What function would be equivalent to the DAX All and AllSelect functions, but using Databricks' aggregation functions through the custom calculation editor? I'm using the custom calculations because using a SQL query would lose the granularity of the data, which would cause errors in the visuals. For example: Sum(value)/sum(value) over()

1 ACCEPTED SOLUTION

Accepted Solutions

szymon_dybczak
Esteemed Contributor III

Hi @genebaldorios ,

I don't use databricks dashboards on my project (we are PBI shop), but I guess you need to use AGGREGATE OVER clause with cumulative frame:

szymon_dybczak_0-1758179485012.png

 

View solution in original post

2 REPLIES 2

szymon_dybczak
Esteemed Contributor III

Hi @genebaldorios ,

I don't use databricks dashboards on my project (we are PBI shop), but I guess you need to use AGGREGATE OVER clause with cumulative frame:

szymon_dybczak_0-1758179485012.png

 

Thanks for the tip, the measurements are as follows:

1. Percentage of Total:

SUM(qty) / (SUM(qty) AGGREGATE OVER (ORDER BY status DESC ALL))


2. Cumulative Percentage SUM(qty) / (SUM(qty) AGGREGATE OVER (ORDER BY status DESC Cumulative))


Calculates the percentage of the cumulative total, sorted by status.

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