Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to obtain a partial total by dimension

Hi all!

Please find image attached:

Mc = Count(total <DESTINAZIONE, MEZZO> MVCDE) * MZPRT // MVCDE and MZPRT are two db fields

Tot Mc = sum(total <DESTINAZIONE> Mc)

Why am I getting 0 values as result? I don't understand where I'm making mistake, the red values shown in figure are the result I would expect...

Do you need to know more details about db structure?

Thanks in advance.

--

Marco Pikiri

1 Solution

Accepted Solutions
giakoum
Partner - Master II
Partner - Master II

Sum(total<DESTINAZIONE> aggr(distinct Count(MVCDE)*MZPRT, DESTINAZIONE, MEZZO))

http://community.qlik.com/thread/61292

View solution in original post

15 Replies
giakoum
Partner - Master II
Partner - Master II

maybe because * MZPRT is not part of any aggregation function

Not applicable
Author

Each "MEZZO" ("DUMPER 1", "DUMPER 2", etc.) has its own MZPRT: which should be the right aggregation function to use in this case? Seeing from documentation "Only()" function, I suppose: is that right?

giakoum
Partner - Master II
Partner - Master II

only is automatically used by QlikView when there is no other stated. try min or max, both should work as it is only one value for each mezzo

Not applicable
Author

Changing "Mc" expression to:

Count(total <DESTINAZIONE, MEZZO> MVCDE) * min(total <MEZZO> MZPRT)

or to:

Count(total <DESTINAZIONE, MEZZO> MVCDE) * max(total <MEZZO> MZPRT)

still outputs 0 values again

But as of my newbieing to QV now another question arises: is it correct the "total <MEZZO> " notation I've put above in the min-max functions?

giakoum
Partner - Master II
Partner - Master II

maybe a sample file would help solve this faster

Not applicable
Author

Sure ok, let's try.

Thanks.

giakoum
Partner - Master II
Partner - Master II

There is no such field as Mc :

So in Tot Mc expression : =sum(total <DESTINAZIONE> MVCDE)

should work

Not applicable
Author

In fact Mc is an expression, not a field.

Values output by:

=sum(total <DESTINAZIONE> MVCDE)

are not correct, i.e. for the ALTRO "DESTINAZIONE" we will have:

27 + 17.5 = 44.5

and not 124 as I can see. There should be a sum of "Mc" expressions, not of MVCDE field.

Please see that MVCDE in my db is an auto-incremental ID field that I use just to count the occurrences of what I'm evaluating.

giakoum
Partner - Master II
Partner - Master II

what expression is Mc? The previous column?