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

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Aggr issue

I have the folowing dataset

MonthPartCompanyOrderIDVolume in KGVolume in ltr
15.81931.122
1Dummie5113A10805552.0904.111
1Dummie5174A1084003305600
1Dummie5175A1084027441868
1Dummie5180A1084257305600
1Dummie5187A1084647362712
1Dummie5187A10847011.2522.464
1Dummie5187A1084715293577
1Dummie5187A10847206101.200
1Dummie5188A1084740483950
1Dummie5189A1084780483950
1Dummie5195A10851695251.033
2Dummie5191A10847822.9275.758
2Dummie5197A10853163.3046.500
2Dummie5201A10854582.4394.799

Now i want a a aggr over the Orderid for the Volume in Ltr

So i can make the folowing calculation

If Volume in ltr for a order >5000 then volume /1000 *62.79 else volume /1000 *91.29

My result must be 2492 as total costs. But my aggr without the orderid dim doesn't work. Anybody an idea?

18 Replies
sgrice
Partner - Creator II
Partner - Creator II

So I take it the sum is by company month?

so is the sum of all orders volume for each company month?

perumal_41
Partner - Specialist II
Partner - Specialist II

Hi Drik.

please try below expression

Sum(Aggr(sum(if([Volume in ltr]>=5000, [Volume in ltr]/1000*62.79, [Volume in ltr]/1000*91.29)),OrderID))

alexandros17
Partner - Champion III
Partner - Champion III

This is the solution, let me know

pokassov
Specialist
Specialist

Why we need aggr?

Not applicable
Author

Allmost good. But there is one row who gives the wrong calculation

perumal_41
Partner - Specialist II
Partner - Specialist II

Hi Drik,

is possible give me scenarios .

Regards,

Perumal A

Not applicable
Author

This is my formula for now

Sum(

  Aggr(

  SUM(

  if(#Volume >5000, #Volume/1000*62.79, #Volume/1000*91.29))

  ,OrderID)

  )

It works on one exeption.

Is het possible to sum the volume before comparing it with 5000.

there is one order loaded on two tanks with dimmension cust_tank.

so he calculates the formule wrong because he thinks its a 2000 ltr drop and a 4500 drop instead of 6500.

Thanks a lot.

perumal_41
Partner - Specialist II
Partner - Specialist II

Hi Dirk,

Try below expression

Sum(

  Aggr(

  SUM(

  if(#Volume >5000, #Volume/1000*62.79, #Volume/1000*91.29))

  ,OrderID,cust_tank)

  )

alexandros17
Partner - Champion III
Partner - Champion III

Sorry,

did you take a look to my document?