Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using aggregation within a calculated field in Amazon QuickSight

I'm using Amazon QuickSight and want to create a calculated field which in Tableau would be sum([Field1])/sum([Field2]). In QuickSight, I attempted sum({Field1})/sum({Field2}) but this did not work ("We encountered an error trying to save your calculated field. Please try creating it again."). Simply doing {Field1}/{Field2} and then applying the sum aggregation in the visualization stage gives me the incorrect value.

How do I apply a SUM within a calculated field?

like image 215
Greg Avatar asked Oct 30 '22 03:10

Greg


2 Answers

In the link Greg posted, Quicksight team answer last year: "Hi All, Calculated fields in analysis are available for data sets that use direct query. SPICE data set support is coming soon.".

I tested it today using spice and it work for me.

I used this formula: distinct_count(field1) / min(field2) and then i used it on a pivot table using other field to group data.

like image 84
vilaboa Avatar answered Nov 15 '22 05:11

vilaboa


It is now possible in Amazon QuickSight. To achieve this you need to add Calculated Field to an Analysis (as described here). There are two types of calculated fields: on a data set level and on on analysis level. You can use aggregations in the analysis level calculated field.

like image 36
Andrey Avatar answered Nov 15 '22 06:11

Andrey