Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

siddharthsoam
Contributor

How to get Totals while using aggr in Qliksense

Hi ,

I am grouping my expression according to a column using 'aggr' in the expression editor. I am not able to get any value in Totals column.

For example,

I want to display aggr(sum(aggr(sum(revenue),city)),country), how can I get the corresponding expression to flash in the Totals row?

  

CountryCityRevenue($ mn)
IndiaDelhi12
IndiaGurgaon4
IndiaNoida11
IndiaPune17
IndiaHyderabad5
IndiaBanglore7
USANew York13
USALA3
USADetroit2
USAWashington15

I want my final aggregation with respect to countries

1 Solution

Accepted Solutions

Re: How to get Totals while using aggr in Qliksense

Why not just use Sum(revenue)? or may be this

Sum(Aggr(Sum(revenue), country, city))

6 Replies

Re: How to get Totals while using aggr in Qliksense

Why not just use Sum(revenue)? or may be this

Sum(Aggr(Sum(revenue), country, city))

shilpan9166
Contributor II

Re: How to get Totals while using aggr in Qliksense

You can have naked aggr expression to show total so as Sunny mentioned, always have an outer aggregation such as sum.

HIC has written an excellent article on how AGGR works.

Set Analysis in the Aggr function

zebhashmi
Valued Contributor

Re: How to get Totals while using aggr in Qliksense

i think

sum(aggr(sum(aggr(sum(revenue),city,country)),country))

wdchristensen
Valued Contributor

Re: How to get Totals while using aggr in Qliksense

Might also verify that Revenue is actually of type number number and not coming in your load as a text.


https://help.qlik.com/en-US/qlikview/November2017/Subsystems/Client/Content/Scripting/LogicalFunctio...

IsNum(Revenue) should return -1. If it returns Zero you are dealing with text and your math function won't work.

dwforest
Valued Contributor

Re: How to get Totals while using aggr in Qliksense

No need to aggr sum of sums.

if the revenue is in the data model at the city, country level or lower (like a time dimenison), a straight sum with city and country as dimensions would sum by those keys.

zebhashmi
Valued Contributor

Re: How to get Totals while using aggr in Qliksense

unless if you want something else than the sum

only Sum(Revenue) is the same

Community Browser