Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Qlik,
I have a list of sites that each do a series of deliveries to mulitple destinations.
I have a table set up with Source [Source Name] as the dimension showing the average cost avg[Total Cost] of delivery to each destination [Destination Name].
Looking at opportunity cost I want to establish as a varible what the cheapest site to ship to is. However merely entering min(Total Cost) gives me back the cheapest delievry overall rather than the average of the site with lowest cost.
Is there a way to create an array within the equation of average total cost to each site and then select the minimum average value?
Regards,
Chris
Perhaps like this: min(aggr(avg([Total Cost]),[Destination Name], [Source Name]))
Perhaps like this: min(aggr(avg([Total Cost]),[Destination Name], [Source Name]))
Thank you Gysbert, worked like a charm.
If your request is resolved, then please close this thread:
As a follow up, I'm now trying to use this to find the next best alternative. So far I have:
if(count(distinct([Destination Name]))>1,
min({$<[Total Cost]={"<>'[Best route]'"}>} [Best Route]))
Where best route is the previous equation.
In general, try to keep a thread to a single request.
Since it's quite similar, maybe
if(count(distinct([Destination Name]))>1,
min(aggr(avg([Total Cost]),[Destination Name], [Source Name]), 2)
)
Apologies Swuehl, will start a new one next time.
Thank you your answer worked perfectly.