Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
ashokpaladugula
Contributor III
Contributor III

Dashboard slowdown when i using the Aggr function with sum function

Hi community,

I want calculate the cost per mile and cost per weight and cost per pallet. I achieved the my result but dashboard slowdown.

This is the scenario.                

ShipmentMilesAmountPalletsWeightServiceCustomerNameCarrierNameModeChargeGroup
74577782681359.112611623LH Fuel SurchargeRockwell AutomationRockwell InternationalTruckloadFuel
74577782681502611623Stop OffRockwell AutomationRockwell InternationalTruckloadAccessorial
7457778268185.012611623LTL Fuel SurchargeRockwell AutomationRockwell InternationalTruckloadFuel
745777826811875.342611623Consol LinehaulRockwell AutomationRockwell InternationalTruckloadTransportation
74577782681739.222611623Consol PickupRockwell AutomationRockwell InternationalTruckloadTransportation
7593211268138.06114778LTL Fuel SurchargeRockwell AutomationRockwell InternationalTruckloadFuel
75932112681192.17114778LH Fuel SurchargeRockwell AutomationRockwell InternationalTruckloadFuel
75932112681346114778Consol PickupRockwell AutomationRockwell InternationalTruckloadTransportation
7593211268150114778Stop OffRockwell AutomationRockwell InternationalTruckloadAccessorial
759321126811061.77114778Consol LinehaulRockwell AutomationRockwell InternationalTruckloadTransportation

     Here i want same shipment has different rates with different services but same mile, weight and Pallets.

So i need sun up the Amount of distinct shipment, miles, Weight and Pallets.

My Expressions like this:

Cost per miles --> Sum ({<Mode = {'TruckLoad'}> }Amount)/ sum({<Mode = {'TruckLoad'}> }aggr(Miles, Shipment))

Cost per Weight --> Sum (Amount)/Sum(aggr(Weight, Shipment))

Cost per Pallet -->  sum(Amount)/sum(aggr(Pallets, Shipment))


Here i have different mode are there. so applied mode condition.

Please anybody suggest 

Thanks,

ASHOK

jaganadamdavi3sawhitfieldhicvinieme12

14 Replies
Not applicable

Did u Tried like this ?

Sum (Amount)/(aggr(sum(Weight), Shipment))

check that is it giving correct result .let me know if I am wrong

ashokpaladugula
Contributor III
Contributor III
Author

Hi Manoj,

thanks for quick reply. but it is not working. It doesn't return any value.

Thanks

ASHOK

Kushal_Chawda

Please provide sample data with expected output

stabben23
Partner - Master
Partner - Master

If its possible, try to map/join Weight, Pallets, Miles into Your transactiontable where you have Amount.

I.ll think shipment will be the Keyfield to use if you for ex use mapping load and applymap.

If they are in the same table there is no need to use aggr.

ashokpaladugula
Contributor III
Contributor III
Author

Hi kushal,

Expected output is like this.

For shipment 7457778

Cost per miles --> (359.11 + 50 + 85.01+ 1875.34 + 739.22) / 2681 = 1.1595225

Cost per Weight --> (359.11 + 50 + 85.01+ 1875.34 + 739.22) / 11623 = 0.26745934

Cost per Pallet -->  (359.11 + 50 + 85.01+ 1875.34 + 739.22) / 26 = 119.564615


Thanks,

ASHOK


ahaahaaha
Partner - Master
Partner - Master

Hi ASHOK,

May be as in attached file?

Regards,

Andrey

stabben23
Partner - Master
Partner - Master

try if this could be an alternative:

Sum ({<Mode = {'TruckLoad'}> }Amount)/ only({<Mode = {'TruckLoad'}> }Miles)

ashokpaladugula
Contributor III
Contributor III
Author

Hi Andrey,

Thanks for your reply.

As per your attachment, we are able show the shipment wise cost per mile. but suppose if we select a particular customer, then sum up the all individual shipment's miles. i.e  here we have 2 shipments. so  miles should be 2681+2681 = 5362. if we take distinct miles it goes wrong.

Thanks,

ASHOK

ahaahaaha
Partner - Master
Partner - Master

If to analyze the content of your data, maybe the value "Transportation" in field "ChargeGroup" is a sign of miles? Then Sum(DISTINCT Miles) is replaced by expression Sum({<ChargeGroup={'Transportation'}>} Miles)?

New version in the attached file.