Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Problem with total/Aggr

Hi !

I'm having some trouble with my calculation. See the exemple below : stationnement.png

It's calculated this way :

[NbPlaces]/([NbRelevés]/[NbRue])=[TotalPlaces]

([NbRelevés]/[NbRue]) = [Coeff] by the way



The problem is that the total shouldn't be like it is right there. For 2014, [TotalPlaces] should be :

951+2552+842= 4345 and not 127 247/(9065/283).

What's the way to do that ?

Thanks you very much in advance.

Antonin

Ce message a été modifié par : Antonin Ramet

1 Solution

Accepted Solutions
sunny_talwar

May be this as your expression:

=If($(=GetCurrentField(Géographie)) = 'Rue',

Sum(

  Aggr(

  Sum({<flag_place={'OK'}>}Nb_places)/(Count(ID_Date)/Count(DISTINCT Impl_compl)),

  $(='[' & GetCurrentField([Géographie]) & ']'), Impl_compl, $(='[' & GetCurrentField([Temps]) & ']'))),

Sum(

  Aggr(

  Sum({<flag_place={'OK'}>}Nb_places)/(Count(ID_Date)/Count(DISTINCT Impl_compl)),

  $(='[' & GetCurrentField([Géographie]) & ']'), $(='[' & GetCurrentField([Temps]) & ']'))))

Capture.PNG

View solution in original post

6 Replies
sunny_talwar

Would you be able to share a sample to look at?

vinieme12
Champion III
Champion III

Hi ,

Aggregate your calculations by Zone as below.

example for nb places / nb releve

sum(aggr(sum({<flag_place={'OK'}>}Nb_places)/(count(ID_Date)/count(distinct Impl_compl)) / count({<flag_montant={'OK'}>}DISTINCT ID_Date),Zone))

Encapsulate your calculations between this

SUM( AGGR ( yourcalculation , ZONE) )

Cheers

V

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
Not applicable
Author

You can find an exemple attached to the first post!

sunny_talwar

May be this as your expression:

=If($(=GetCurrentField(Géographie)) = 'Rue',

Sum(

  Aggr(

  Sum({<flag_place={'OK'}>}Nb_places)/(Count(ID_Date)/Count(DISTINCT Impl_compl)),

  $(='[' & GetCurrentField([Géographie]) & ']'), Impl_compl, $(='[' & GetCurrentField([Temps]) & ']'))),

Sum(

  Aggr(

  Sum({<flag_place={'OK'}>}Nb_places)/(Count(ID_Date)/Count(DISTINCT Impl_compl)),

  $(='[' & GetCurrentField([Géographie]) & ']'), $(='[' & GetCurrentField([Temps]) & ']'))))

Capture.PNG

tyagishaila
Specialist
Specialist

Go to expression TAB --> Total Mode -->Click on 3rd option and select Sum of Rows

Not applicable
Author

This works like a charm, thanks !!