Rogelio Arosemena
Rogelio Arosemena

Reputation: 41

On Query Viewer, how to show percentages based on Row totals (not Column total)?

I have been using the Query object for some time and I can not find how to show the percentage of a value over the total of the row.

On this Genexus Query Usage Example, it shows totals by Continent, Country and Attraction.

How this query must be configured to show the attractions percentage over row totals to get a result like this:

enter image description here

Upvotes: 0

Views: 163

Answers (1)

Gustavo Martínez
Gustavo Martínez

Reputation: 56

Those numbers in the image you posted come from a QueryViewer example. They represent the total sales of Soy, Wheat and Rice per Continent and Country. There are three different measures in this query, and you cannot make calculations among measures in the QueryViewer, so you can't achieve what you want with these numbers. But you can modify or make your query so that there is only one measure, let's say "Sales amount", and the Crop can be one dimension:

Dimensions: Continent, Country and Crop

Measures: Sales amount

Once the data is presented like this, the percentage will show exactly what you want.

PS: By "dimension" I mean attributes without aggregation and by "measure" I mean those attributes that have any aggregation function (Sum, Average, etc.)

Upvotes: 1

Related Questions