Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi I'm trying to make an expression run ignoring all selections. I have created this expression (see below) to deduce time spent traveling but it is being affected by selections.
Can someone tell me where I'm going wrong?
SUM({1} AGGR({1} MRDuration,TravelLeg))
This probably makes some sense, depending on what is to calcualte:
sum({1} aggr(SUM({1} MRDuration), TravelLeg))
Not clear what aggr is doing here. Try this
SUM({1} MRDuration)
You should probably not use Aggr() at all.
Try Sum({1} MRDuration).
See also When should the Aggr() function NOT be used?
HIC
This probably makes some sense, depending on what is to calcualte:
sum({1} aggr(SUM({1} MRDuration), TravelLeg))
Michael
Hypothetically, your 2nd formula may make sense, yes.
But only if one MRDuration can belong to several TravelLegs. If one record of MRDuration only can belong to one value of TravelLeg, then the Aggr() is redundant.
HIC
Henric,
Absolutely agree. Just tying to keep it working even with aggr() - which is most likley redundant here.
can you attach ur qvw file?
I wish I could circumvent the aggr but what I have is a table of travel durations based on pairs of post codes and a table of stages of journey (per job) linked by a postcodepair key.
What I am looking to do on the dashboard is provide a total distance travelled but if I use Sum({1} MRDuration) I will get the sum of all the distances held in the distances table not the total distance travelled during all the jobs.
I hope I'm making sense...
Since I do not have the data, I cannot help you.
But if a distance (MRDuration) can belong to/be used by several TravelLegs, then you should use the Aggr() function just like Michael Solomovich suggests:
sum({1} aggr(SUM({1} MRDuration), TravelLeg))
HIC
Thanks guys I believe that has resolved my issue.