Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
We have an table of Places and Distances, where the distance is the travel distance from various Offices to those Places.
Table 1: Offices
Office A
Office B
Table 2: Office, Place, Distance
Office A, Place 1, 5
Office A, Place 2, 15
Office B, Place 1, 6
Office B, Place 2, 12
Distance is calculated from every Office to every Place. The table we want will have Office, the nearest Place, and min(Distance). Only 1 row per Office.
Office A, Place 1, 5
Office B, Place 1, 6
How can we approach this in Qlik? Is it possible either in the load script or in creating a table with calculated dimensions?
May be like:
Table Dim : Office
Exp 1 (Place) : FirstSortedValue(Place, -Distance)
Exp 2 (Distance) : Min(Distance)
Hi,
Should the output be
Office A, Place 1, 5
Office B, Place 2, 12
or
Office A, Place 1, 5
Office B, Place 1, 6
-karthik
Karthik, you are correct thank you. We want the closest Place to every office, and Place 1 is closest to every office. I've updated the original post.
May be like:
Table Dim : Office
Exp 1 (Place) : FirstSortedValue(Place, -Distance)
Exp 2 (Distance) : Min(Distance)