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

Announcements
Only at Qlik Connect! Guest keynote Jesse Cole shares his secrets for daring to be different. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Help - variable declaration

Dears,

I've the following expression in the Script Editor.

var_mid_lat=min(Latitude)+(1+var_lat_offset)*((max(Latitude)-min(Latitude))/2)'

Basically this expression sets the "average" latitude for all items listed in my excel spreadsheet, but my doubt is:

I want to have the same expression calculating the same thing but only for NAC Customers.

And my spreadsheet have 3 main collumns, that are: Latitude, Longitude and Region.

And I've 4 regions that are: NAC, EMEA, ASIA and LATAM...

So, how could it be done?

Could you give me an example?

Thanks you so much

2 Replies
Not applicable
Author

var_mid_lat = Sum({$<Region={'NAC'}>}(min(Latitude)+(1+var_lat_offset)*((max(Latitude)-min(Latitude))/2)))

Hope this will help you

CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,

     You can use set analysis for this.

     var_mid_lat=min({<regions={'NAC'}>} Latitude)+(1+var_lat_offset)*((max({<regions={'NAC'}>} Latitude)-min({<regions={'NAC'}>} Latitude))/2)'

Hope it helps

Celambarasan