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: 
saniyask
Creator
Creator

How do i calculate radius within some range

Hi,

I have a requirement where i have some state and cities corresponding to those States, what i need to do is create a link through which i can input a value eg: 40 km and select a state and city and the output should be the values that fall into the range of 40 km within that state and city..

for deriving this i have created a Cartesian product of my table and linked all my fields. but i am not able to achieve the desired output. How can i implement this in my chart.

Pls refer to the script below

Radius:

LOAD State,

     City,

     City as City1,

     Lat,

     Lon,

     Date,

     Sales

FROM

(biff, embedded labels, table is Sheet1$);


1:

Load

City as City2,

Lat as Lat2,

Lon as Lon2,

State as State2

Resident Radius;

Join

Load

City as City3,

Lat as Lat3,

Lon as Lon3,

State as State3

Resident Radius;

Load

*,

City2 as City, 

((SQRT(pow(69.1*(Lat3-Lat2)/100,2) + pow(53.0*(Lon3-Lon2) /100, 2)))) as Distance,

ACOS(SIN([Lat3]*Pi()/180)*SIN(Lat2*Pi()/180)+COS([Lat3]*Pi()/180)*COS(Lat2*Pi()/180)*COS((Lat2*Pi()/180)-([Lon3]*Pi()/180)))*6371 as [Distance (km)]

resident 1;

Drop table 1;

Regards,

Saniya.

2 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

Perhaps this discussion helps: Re: How do I use latitude and longitude values to find near by records


talk is cheap, supply exceeds demand
saniyask
Creator
Creator
Author

Hi Gysbert,

I had already referred to that discussion but i am not able to frame a syntax through which i can get the exact details, as per my earlier question.

Regards,

Saniya