Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Weekly Challenges

Solve the challenge, share your solution and summit the ranks of our Community!

Also available in | Français | Português | Español | 日本語
IDEAS WANTED

Want to get involved? We're always looking for ideas and content for Weekly Challenges.

SUBMIT YOUR IDEA

Challenge #15: Warehouse Shipped Miles

CailinS
Alteryx
Alteryx

Like a little puzzle - fun!

Cailin Swingle
Customer Experience
mulvihi11
8 - Asteroid

A nice challenge to get familiar with spatial tools!

Spoiler
mulvihi11_0-1588966031791.png

 

VegasBeans
6 - Meteoroid

Completed!

Thrown off by the distance goal of each item, but multiplying distance by Assigned and then taking the Sum worked.

 

VegasBeans_0-1589158872738.png

 

 

sumanthskumar
8 - Asteroid

This was fun 🙂

jarrod
ACE Emeritus
ACE Emeritus

not too bad in python when you find geopy.distance. 

Spoiler
jarrod_0-1589377826694.png

and the python code:

from ayx import Alteryx
import pandas as pd
from geopy.distance import geodesic
import numpy as np

store = Alteryx.read('#1')
item = Alteryx.read('#2')
warehouse = Alteryx.read('#3')

# found helpful tips from following site:
# https://gis.stackexchange.com/questions/273304/how-to-measure-distance-between-2-gps-points-in-pandas

# append all warehouses to stores to find closest
storeWarehouse = pd.merge(store.assign(key=0), warehouse.assign(key=0), on='key').drop('key', axis=1)

# calculate distance between stores and warehouses
storeWarehouse['MILES'] = storeWarehouse.apply(
    (lambda row: geodesic(
        (row['Lat_x'], row['Lon_x']),
        (row['Lat_y'], row['Lon_y'])
    ).miles),
    axis=1
)

# find closest warehouse
closest = storeWarehouse.loc[storeWarehouse.groupby(["Store"])["MILES"].idxmin()].drop({'Lat_x','Lon_x','Lat_y','Lon_y','City_x','City_y','State_x','State_y','Priority','Warehouse'}, axis=1)

# join list to items
items = pd.merge(closest, item, on='Store')

# calculate total distance for each item per store
items['Total Distance'] = items['MILES']*items['Assigned']

# Grouping by item, summarize total distance
summary = items.groupby(by='Item').agg({'Total Distance':'sum'}).reset_index()

Alteryx.write(summary,1)

#SnakingMyWayThruChallenges

loganmjung
7 - Meteor

I wasn't aware of the find nearest tool until I saw someone's spoiler so I came up with this convolution flow involving the Distance Tool. 

 

loganmjung_0-1589388340492.png

 

 

Emil_Kos
17 - Castor
17 - Castor

Hi,

 

Sharing my solution.

 

I don't have much experience with Spatial tools. Thanks to that this exercise was especialy interesting for me.

 

Spoiler
Challenge_15_Emil_Kos.PNG

 

DavidLane
8 - Asteroid

Nice straightforward one this time 🙂

DMContente
8 - Asteroid

My solution

edavilac
8 - Asteroid

My solution attached, very cool challenge!

 

Spoiler
Challenge_15_edavilac.PNG