Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
rh_pg
Contributor II
Contributor II

Aggr() calculating only in one row

hi, I got this formula

 

=Aggr(Sum(
rangemax(ActualWeight,
If(Left(ShipperName, 😎 = 'SLOVNAFT',
If(ActualWeight < 100,
If(Colli > 1,
ActualWeight,
If(ActualWeight < 200,
200,
If(ActualWeight < 400,
400,
ActualWeight
)
)
),
If(ActualWeight < 200,
200,
If(ActualWeight < 400,
400,
ActualWeight
)
)
),
'trf vzorec'
),
Volume*300,
LoadingMeters*1250
)
), TransportNumber)

 

when I use it as dimension, it works correctly, but when I use it as a measure, it provide result only for one row which met conditions. But I need to use it as measure because I need to calculate it with that values in other columns.

 

regards,

P

Labels (2)
4 Replies
vincent_ardiet_
Specialist
Specialist

You can try to add a SUM() around your expression, else AGGR is returning a set of data.

rh_pg
Contributor II
Contributor II
Author

Thank you for hint! Unfortunately it did not work 😞

 

rh_pg_0-1703231684274.png

 

maybe my original intention is not necessary (to have value in each row), but I need to calculate % from that number in other column and it is not working with zero values, but I do not know how to do that.

rh_pg
Contributor II
Contributor II
Author

UPDATE:

I got formula working with =Sum(TOTAL <TransportNumber> ActPayweight)

but ActPayweight is original Dimension. Formula does not work with created columns even if its Measure. Tried Column(4) as well. 

 

Problem is ActPayweight is not correct. That is why I calculate it here manually.

Javizh
Partner - Contributor III
Partner - Contributor III

Hello @rh_pg 

Try using your original formula with NODISTINCT :

  • Aggr(NODISTINCT Sum(....

Best regards.