Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Qlik® Product Spotlight: Discover what’s possible. Get more from our products.
See for yourself. Register today.
inescastelhano
Not applicable

Total in all rows

Hi all,

I have this table in Qlik Sense:

print.png

And I am using the following expression for last column:

sum(Aggr(Sum({$<Product=,Flag={'Sales'}, Source={'MySales'}>}Value),Year_Month))

I get the total (I want the total of the first column - 859 709 705.56) on the total aggr column, but I want this value to be shown in all rows. Because basically I will need to divide the first column values by this last value.

Does anybody know how to do this?

Thanks in advance!

Cheers,

Inês

Tags (1)
1 Solution

Accepted Solutions
sunny_talwar
Not applicable

Re: Total in all rows

I guess the alternative might be to do something like this:

Aggr(NODISTINCT Sum({$<Product=,Flag={'Sales'}, Source={'MySales'}>}Value), Year_Month)

6 Replies
sunny_talwar
Not applicable

Re: Total in all rows

Try this:

Sum(TOTAL <Year_Month> {$<Product=,Flag={'Sales'}, Source={'MySales'}>}Value)

inescastelhano
Not applicable

Re: Total in all rows

Unfortunately that does not work because if I do that, it will somehow not consider the Year_Month... and it will give me the totals for ALL months.

print2.png

sunny_talwar
Not applicable

Re: Total in all rows

I am not sure why it wouldn't consider Year_Month if we specifically gave the field name Year_Month in the total qualifier? Are you sure you added this?

Sum(TOTAL <Year_Month> {$<Product=,Flag={'Sales'}, Source={'MySales'}>}Value)

sunny_talwar
Not applicable

Re: Total in all rows

I guess the alternative might be to do something like this:

Aggr(NODISTINCT Sum({$<Product=,Flag={'Sales'}, Source={'MySales'}>}Value), Year_Month)

inescastelhano
Not applicable

Re: Total in all rows

I did, I also don't understand why the first option is not working...

But it worked with the NODISTINCT could you please explain me how exactly it works?

Once again, Thank you so much!!

Inês

sunny_talwar
Not applicable

Re: Total in all rows

When you used only one dimension from your chart within your Aggr() function, there is a grain mis-match. And when this happens, the value is assigned to just one of the rows instead of getting populated all rows. By adding NODISTINCT you can ask Aggr() to populate those values on all rows. Read some more about this here:

Pitfalls of the Aggr function