Skip to main content
Announcements
Customer Spotlight: Discover what’s possible with embedded analytics Oct. 16 at 10:00 AM ET: REGISTER NOW
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?

1 Solution

Accepted Solutions
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))

View solution in original post

18 Replies
sgrice
Partner - Creator II
Partner - Creator II

I am unsure why you would need aggr here there OrderID is Lowest Level so

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

alexandros17
Partner - Champion III
Partner - Champion III

Yes, use a straight table, and do not use "Expression Total" but use "Sum of Rows" in the Expression Tab

Not applicable
Author

for each orderid he has calculate if the total order is >5000. and then i know which Tarief ineed to choose.

Then i don't need the orderid in my table and can i calculate my total costs.


My result should look like


Company total litres total costs

Dummie   31.122  €2492


pokassov
Specialist
Specialist

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

and I have 2492

May by your problem is ".' betweeen numbers?

Not applicable
Author

for each orderid i have to calculate if the total is above 5000

then i need a result table with te total costs.

With a orderid in the table it works with every formula. But i only want a total result.

How is that possible?

sgrice
Partner - Creator II
Partner - Creator II

There is only one row per orderID so why do you need to aggr?


alexandros17
Partner - Champion III
Partner - Champion III

As I told you before the problem is only due to totals because the expression, when computed on total has only 1 value (that is the total). This is the reason for which total must be computed as sum of all rows not as single expression

Let me know

Not applicable
Author

I have 14 orders

From that orders i have to know the total costs

For each order id i need to now the total volume.

If the volume for an order is above 5000 then that volume from that order *tarief 1 else that volume from that order for 8 tarief to.

The caclulation has to be displayed als a total volume in a row without the orderids,

More simple then that i can't make my question

pokassov
Specialist
Specialist

As we can see each order has one row in your dataset.

What do you mean telling us total volume?

Do you have rows for items in the orders in you data model?