# Getting SUM when I expect AGG, when dragging out LOD calc from measure drawer

**Shaun Currier**Nov 25, 2015 9:15 AM

Hello,

What I am trying to do overall

My company sells widgets that have an hour meter on them to tell how long they've run for. I want to calculate some statistics about how much they run per year. I want to look on a per-widget basis, but also on two other levels above the widget level- call those levels the model and the product family. When I look at the model level, Tableau will naturally give me statistics about the level below the model level, which is the widget level. That's what I want. But when I look at the product family level, Tableau will still naturally give me statistics about the widget level, but instead I want the stats aggregated once at the model level before rolling up to the product family level.

The columns I am working with as it relates to this problem

[Tot Hr Cum Qty] - the hour meter reading for the widget (direct from database source)

[Hrs Since Delivery] - the number of hours since customer recieved the widget (calc'd from two other columns I won't describe here)

My main calculation

AVG([Tot Hr Cum Qty]/[Hrs Since Delivery]*365*24)

This will calculate the number of hours a widget has run per year that the customer has had it.

To get the right cascading of statistics that I described in "what I am trying to do overall" (above), I am wrapping this in a LOD expression:

{INCLUDE [model]:AVG([Tot Hr Cum Qty]/[Hrs Since Delivery]*365*24)}

My problem

When I use the non-LOD version of my main calculation, I can drag the measure pill out of the measure drawer and the pill will show the AGG() function wrapping the measure. This is proper and expected because the calc contains the AVG() function, which is an aggregation function. But when I try to use the LOD version of my main calculation, dragging the pill results in the SUM() function wrapping the measure. I don't want a sum of averages because that makes no sense. I just want control over how the AGG() aggregation is happening and that's what I thought that the LOD expression would provide me. But for some reason the LOD expression is preventing me from aggregating at all.

I've tried changing all kinds of things around to see if I could suss out what is causing this issue, but I have not been able to find it. I'd appreciate any help that anyone can give me. Unfortunately, I don't think I'll be able to send the worksheet since it relies on a database connection and some proprietary data.