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:ย 

flexible Calculated field in Dashboard changing with filters used

a_d
New Contributor II

Hi guys,

I am making a Dashboard where I want to show the AOV per Brand with a date filter to change the days used in the calculation.

AOV = sales / orders

I have sales and orders per day and would like to have the AOV dependant on the Days selected.

The only way I found to display the AOV is to calculate it per day and then put an avg() over it in the widget, but this doesnยดt show the the true number (avg of avg). Ideally it would be sth similar to what you can do in excel with pivot calulated fields.

I am using sql

1 ACCEPTED SOLUTION

Accepted Solutions

Ashwin_DSA
Databricks Employee
Databricks Employee

Hi @a_d - Thanks for confirming.

Here is a good example.

I've also tested it and given some snapshots below if it helps. My data looks something like the below.

 

AOV_1.jpg

You can see above the results (on the right side) an option to create a custom calculation. In the editor, add the formula. SUM(sales) / SUM(orders)

AOV_2.jpg

You can then build the visualisation and choose the custom measure you have created. 

AOV_3.jpg

Hope that helps!

If this answer resolves your question, could you mark it as โ€œAccept as Solutionโ€? That helps other users quickly find the correct fix.

Regards,
Ashwin | Delivery Solution Architect @ Databricks
Helping you build and scale the Data Intelligence Platform.
***Opinions are my own***

View solution in original post

4 REPLIES 4

Ashwin_DSA
Databricks Employee
Databricks Employee

Hi @a_d,

Could you please confirm that you are referring to dashboards in Databricks and not another reporting tool?

And, when you mention a flexible calculated field, do you mean a Custom Calculation? If not, have you considered using a custom calculated measure?

If this answer resolves your question, could you mark it as โ€œAccept as Solutionโ€? That helps other users quickly find the correct fix.

Regards,

Regards,
Ashwin | Delivery Solution Architect @ Databricks
Helping you build and scale the Data Intelligence Platform.
***Opinions are my own***

a_d
New Contributor II

Hi @Ashwin_DSA ,

yes Iยดm referring to Dashboards in Databricks.

Can you explain how I could create a calculated measure? I think this would solve my problem.

I want the user to be able to change the daterange on the datepicker and then the AOV would be calculated based on the sales for the dates filtered.

 

 

Ashwin_DSA
Databricks Employee
Databricks Employee

Hi @a_d - Thanks for confirming.

Here is a good example.

I've also tested it and given some snapshots below if it helps. My data looks something like the below.

 

AOV_1.jpg

You can see above the results (on the right side) an option to create a custom calculation. In the editor, add the formula. SUM(sales) / SUM(orders)

AOV_2.jpg

You can then build the visualisation and choose the custom measure you have created. 

AOV_3.jpg

Hope that helps!

If this answer resolves your question, could you mark it as โ€œAccept as Solutionโ€? That helps other users quickly find the correct fix.

Regards,
Ashwin | Delivery Solution Architect @ Databricks
Helping you build and scale the Data Intelligence Platform.
***Opinions are my own***

a_d
New Contributor II

Hi @Ashwin_DSA ,

thank you so much, thatยดs excactly what I wanted ๐Ÿ™‚