Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
inescastelhano
Partner - Creator II
Partner - Creator II

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

1 Solution

Accepted Solutions
sunny_talwar

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

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

View solution in original post

6 Replies
sunny_talwar

Try this:

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

inescastelhano
Partner - Creator II
Partner - Creator II
Author

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

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

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

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

inescastelhano
Partner - Creator II
Partner - Creator II
Author

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

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