Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Summation Expression

I am wanting to sum the PUM Miles (in yellow) and the LH and LTL Miles (in green) in a Text Box. The LH and LTL Miles are all valid (total is 1018), but only one PUM is valid (total is 15). The value of Total Miles should be 1033. However, my expression returns the total of 1063 (it includes all 3 PUM Miles (total 45). 1063 is incorrect, 1033 is the correct answer.

I can use some help to direct me towards the valid soliution. The field PickupMoveTravelDistance is the PUM Miles, while the TravelDistance field is the LH and LTL Miles

Thanks

Vic

='Total Transit Miles ' &Num(sum({DISTINCT}[PickupMoveTravelDistance]+TravelDistance),'#,##0')

ProNumberPro WeightPU WeightPUM WeightPUM MilesLH and LTL WeightMoveTypeLH and LTL Miles
2984464813885092258941530789LH950
298446481388509225894151388LTL5
2984464813885092258941512304LH63


4 Replies
dvasseur
Partner - Creator III
Partner - Creator III

If PUM Miles has always the same value the following should work:

='Total Transit Miles ' & Num(avg([PickupMoveTravelDistance])+sum({DISTINCT} TravelDistance),'#,##0')

HTH,

David

dvasseur
Partner - Creator III
Partner - Creator III

If PUM Miles has always the same value the following should work:

='Total Transit Miles ' & Num(avg([PickupMoveTravelDistance])+sum({DISTINCT} TravelDistance),'#,##0')

HTH,

David

Not applicable
Author

Thanks David. This works when there is a single pro number. It doesn't when there are multiple records. the example below has 5 records for 2 pro numbers.

Vic

ProNumberPro WeightPU WeightPUM WeightPUM MilesLH and LTL WeightMoveTypeLH and LTL Miles
291379132226230000300001043262LTL5
291379132226230000300001043262LH863
29332660211649509495091339429LH921
29332660211649509495091318225LH63
29332660211649509495091344519LTL5


dvasseur
Partner - Creator III
Partner - Creator III

Maybe this then 🙂

='Total Transit Miles ' & Num(Sum(Aggr(avg([PickupMoveTravelDistance]), [Number]))+sum(TravelDistance),'#,##0')

I don't know if the DISTINCT is required for TravelDistance but add it if needed!