jjmontesl / cubesviewer

Explore and visualize analytical datasets
http://www.cubesviewer.com
Other
441 stars 112 forks source link

aggregates sum returns 0 when column contains positive and negative numbers #99

Closed TenYearsGone closed 5 years ago

TenYearsGone commented 5 years ago

Python version 2.7.9 CubesViewer 2.0

I have a postgresql view column that contains both positive and negative (double precision) numbers. When using aggregates sum in model.json the cubes viewer view returns only 0s (albeit with sometimes a negative sign). When I modify the database view and put ABS over the column, the cubes viewer sums correctly (although the values are incorrect). Is this a bug? in CubesViewer or Cubes?

jjmontesl commented 5 years ago

Can you post an excerpt of the resulting JSON?

(Use the browser inspect tools to inspect the "network" requests, and check the result of the query that brings the data. The resulting JSON contains the raw data which we can check to see if this is on Cubes or CubesViewer side).

TenYearsGone commented 5 years ago

{ "summary": { "netamount_sum": -4.27825774806934e-10 }, "remainder": {}, "cells": [], "aggregates": [ "netamount_sum" ], "cell": [], "attributes": [], "has_split": false } Looks like CubesViewer isn't rendering it possibly because it's too small. The returned sum is correct according to the data in the database. We noticed that the currency data values in the database (which was migrated from SQL) are floats. Once we applied rounding the problem was addressed, I think.

jjmontesl commented 5 years ago

Thank you for the feedback. I'm closing this as not a bug then.