Does Apache Superset support Weighted Averages? - analytics

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.

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.
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
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.

Related

combining the impact of absolute value and YoY change

I am currently working on a problem where we are ranking a customer demographic by absolute value of sales or by the YoY (year-over-year) change in sales.
As is obvious, looking at both these metrics at the same time lets us know whether the growth we are witnessing is actually substantial or not.
For example, let's say a state had a YoY growth of 200% by the end of 2021, but if the absolute value of sales only changed from $100 to $300, it is not actual growth with regards to the hundred thousand dollar values we usually see for other states.
I am looking for ways to combine the effect of both these metrics (absolute value and YoY change) and create a composite metric which can be used to rank my customer demographic.
A common way to combine two metrics is to normalise them to the same range, e.g. 0..1 and then take a weighted average. However there's always a question as to what the weights should be, and, more importantly, what such a metric means. From my experience, I'd advise against trying to combine metrics this way.

Calculated field for Percentage difference in data studio

I need to have the percentage difference between different time duration for the same raw data coming from Analytics. Unable to do so as metrics from data source doesn't consist any time duration and in order to create calculated field I'm supposed to use the metrics from the data source. How shall I go about creating the percentage difference in this scenario?
Feel free to ask follow up.
If I understand you correctly then you can't do a calculated metric to achieve what you are after. The only option available is "comparison to period" but I'm guessing from what you've put there that it isn't possible either.
The only way to achieve this would be by organising you data in your data source to be something like
Date | metric value | metric value to compare to
But I appreciate this may not be as flexible as you'd like

Calculating Average Weekly Traffic in Data Studio

I've got a table in Google Data Studio showing monthly traffic numbers and I would like to have another table that shows average weekly traffic based on the monthly numbers in another table on the same page.
Having some trouble figuring out the custom calculated field formula for this. Any help would be appreciated.
This seems to work for me.
SUM(Sales)/COUNT_DISTINCT((EXTRACT(ISOWEEK from DATE)))
From your example, is it not as easy as your monthly traffic numbers / 4.34?
Depending on how you want to present this, there's a pretty easy, and decent solution - Reference Lines.
Using a reference line, you can chart weekly values (ie: weekly sessions) on a bar chart, then via a reference line, you can plot 1 line for the average of that period (all the bars currently present). Because it is native to the visualization it will recalculate as you you filter!

SSAS Tabular calculated measures missing from Power View fields list

I have defined a calculated measure named "Gross Margin" for my "FactInvoiceLineItem" table. I can see this measure in the Measures dimension (along with several others):
These measures work fine in a PivotTable, but they are absent from the field list in Power View:
I've seen similar issues with PowerPivot and e.g. date columns but that issue shouldn't apply here since the result of the calculation is numeric. We've tried wrapping the calculation in a CALCULATE() anyway, but it didn't help.
There are examples of using measures with Power View from a PowerPivot model. Am I missing some setting in my model, or is this a quirk with Power View and SSAS Tabular?
As mmarie suggests, it's not a limitation of Power View and Tabular - except that Power View only supports numeric measures.
We had included in our calculated measure some custom formatting using FORMAT() to apply parenthesis to negative numbers, which rendered our nice numeric calculation into text. Thus, Power View wouldn't display our measures because they were no longer numeric!
Stripping the FORMAT() out returned the calculation to a numeric type, and made it available in Power View.

Map displaying many measures

I need to create a SSRS report with many measures in a map.
For example, how do I display Total sales in colour and Prices in bullets?
There is a map component to SSRS, but you'll need a spatial data set that defines the points or shapes you want your measures mapping to. There are a bunch of US-centric ones it comes with, and maybe a world one at the country level.
I'm not sure about how much information you could put on the annotations, but you can also combine traditional reporting techniques with the map and have a side bar with your metrics.
One caveat, I think the maximum size of the map component is 36 inches (last time I used it anyways), if you're looking for larger you'll likely need to use some GIS software instead.

Resources