I have some Boolean and string variables that I want to display in the info window on carto db. But it seems to be only showing one individual data point. How do I get it to show modes or averages of the entire data set?
1 Answer
You need to add some SQL to make that information available. If you open the SQL tray and change SELECT * FROM your_table
to:
SELECT *, avg(interesting_column) OVER () AS table_avg
FROM your_table
Now toggle the new variable on in your infowindow to make it available. Just fill in interest_column
with the numeric column you want information from, and make sure to update your_table
with the appropriate name.
-
1The SQL trick mentioned here is called a Window Function and you can get more details about them here. They are really useful!! Commented Jun 13, 2016 at 17:21