Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
AH
Creator III
Creator III

Nearest distance calculation

I have the X and Y coordinate in the Pos.txt file with a PosID field and

X and Y coordinate in the Dod.txt file with an ID field.

My goal is to consolidate this two-tables into one table based on the X and Y coordinate.

So, what ‘PosID’ falls under what ‘ID’ based on the nearest X & Y coordinates of the PosID to the X & Y coordinates of the ‘ID’ field? is the condition to achieve this goal.

Any Help is highly appreciated.

Thanks & Regards,

1 Solution

Accepted Solutions
duncanblaine
Creator
Creator

Hi Shan

I found a few posts about similar calculations and I've applied them to an app that demonstrates what I hope you're after.

The crucial part of the calculation is the Distance Calculation which is done using a Macro.

If found reference to that here distance between two coordinates

Your requirement is a bit different to that example as you want to group certain locations under others based on distance. My app shows how to do that. It ended up being simpler than I thought.

Hope this helps.

DistanceFromID.PNG

View solution in original post

2 Replies
duncanblaine
Creator
Creator

Hi Shan

I found a few posts about similar calculations and I've applied them to an app that demonstrates what I hope you're after.

The crucial part of the calculation is the Distance Calculation which is done using a Macro.

If found reference to that here distance between two coordinates

Your requirement is a bit different to that example as you want to group certain locations under others based on distance. My app shows how to do that. It ended up being simpler than I thought.

Hope this helps.

DistanceFromID.PNG

AH
Creator III
Creator III
Author

Hi Duncan,

Thank you so much for the solution! It works great.

Regards,