Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Apache Superset support Weighted Averages?

I'm trying to use Apache Superset to create a dashboard that will display the average rate of X/Y at different entities such that the time grain can be changed on the fly. However, all I have available as raw data is daily totals of X and Y for the entities in question.

It would be simple to do if I could just get a line chart that displayed sum(X)/sum(Y) as its own metric, where the sum range would change with the time grain, but that doesn't seem to be supported.

Creating a function in SQLAlchemy that calculates the daily rates and then uses that as the raw data is also an insufficient solution, since taking the average of that over different time ranges would not be properly weighted.

Is there a workaround I'm not seeing? Is there a way to use Druid or some other tool to make displaying a quotient over a variable range possible?

My current best solution is to just set up different charts for each time grain size (day, month, quarter, year), but that's extremely inelegant and I'm hoping to do better.

like image 429
JZ1987 Avatar asked Jul 21 '20 15:07

JZ1987


People also ask

What can you do with Apache superset?

Apache Superset is an easy-to-use Business Intelligence tool that collects and processes data in large volumes to produce visualized results like charts and graphs. Thus, the web application allows users to generate dashboards and reports which aid business growth.

Is Apache superset good?

Apache superset comes with a great number of features. It helps you explore, visualize and analyze your data easily. It provides: Blazing fast, real-time queries on live data, saving time for ML Engineers and Business Analysts.

How popular is Apache superset?

The project saw 17.7% year-over-year growth in the number of people that starred the project and 46.9% year-over-year growth in pull requests. The popularity and growth of the Superset project fueled its jump into the top 200 most popular projects on Github.

Is Apache superset enterprise ready?

Apache Superset is a modern, enterprise-ready business intelligence web application. Superset provides: An intuitive interface for visualizing datasets and crafting interactive dashboards. A wide array of beautiful visualizations to showcase your data.


Video Answer


1 Answers

There are multiple ways to do this, one is using the Metric editor as shown bellow, in this case the metric definition is stored as part of the chart.

metric editor

Another way is to define a metric in the "datasource editor", where the metric will be stored with the datasource definition, and become reusable for any chart using this datasource, as shown here

enter image description here

Side note: depending on the database you use, you may have to CAST from say an integer to a numeric type as I did in the example, or multiply by 100 in order to get a proper result that's useful.

like image 86
mistercrunch Avatar answered Oct 24 '22 04:10

mistercrunch