Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I'm aving a map as below and when when i click on site(red dot) the map should zoom into 50 km radius.
Let me know how to get this.
Thanks...
Steven,
Where would you enter the above formula (in the Store ID layer or Cust ID layer)?
Secondly do I define the variable as
LET vLAT = "Store Latitude";
LET vLONG = "Store Longitude";
Finally when I type the following formula I receive an "Error in expression"
Error in expression: ')' expected
I used the excel file that was provided by Krish2459 to load data in Qlik Sense
If(GetSelectedCount([Store ID])>0,
IF(Round(ACOS(SIN([Customer Lattude]*Pi()/180)*SIN($(vLAT)*Pi()/180)+COS([Customer Lattude]*Pi()/180)
*COS($(vLAT)*Pi()/180)*COS(($(vLONG)*Pi()/180)-([Customer Longitude]*Pi()/180)))*3963)
<=31.07
,[Cust ID])
,[Cust ID])
If you are using Krish's Data the fields were backwards. The vLat and vLong need to be the Customer ID. If your data is correct it would be the Store lat/long. I don't generally create my variables in the load. So the Let vs Set by coming into play there area. What you want is for it to place the value of the single selection of the field in your variable.
With the formula, that is placed in the dimension of the customer ID layer. It should be working in there, I copy and pasted yours right into mine without error. Reminder here that the Fields are backwards in Krish's data and where you have Customer Lat or Long needs to be Store Lat/Long.
Two other options to help optimize this a bit more:
1. Adjust the draw order in layer options for the Store ID layer to be non auto and set to 1. This will allow that layer to always display above your other points.
2. With this example there were 1000s of customers, which is likely normal in any case use of this. You can set this layer to not display at all until you select a store by using the calculation condition:
IF( GetSelectedCount([Store ID])>0, 1,0)
This helped the performance of the app display tremendously.
Removed the variable from the data load as suggested. Formula was placed in the Customer ID layer and worked perfectly with no errors. Also introduced a variable for the radius, so end user can set a distance of choice.
thank you!
@JesseRobby Great to hear. Also like the addition of the variable for the distance, have done the same in a personal version of this! Glad this worked for you!