{"id":178,"date":"2021-11-18T22:36:56","date_gmt":"2021-11-18T22:36:56","guid":{"rendered":"http:\/\/approbato.com\/blog\/?p=178"},"modified":"2022-08-04T18:57:08","modified_gmt":"2022-08-04T18:57:08","slug":"create-groups-based-on-metrics-and-change-it-with-variables","status":"publish","type":"post","link":"https:\/\/approbato.com\/blog\/create-groups-based-on-metrics-and-change-it-with-variables\/","title":{"rendered":"Create groups based on metrics (and change it with variables)"},"content":{"rendered":"\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n\n\n\n<p class=\"has-vivid-red-color has-text-color\">Hi! <strong>Before you read it through, please tell me what kind of Qlik content you think is relevant or interesting to have in the channel (use the link below). Thanks!<\/strong><\/p>\n\n\n\n<p>Link: <a href=\"https:\/\/approbato.com\/blog\/quick-qlik-survey\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/approbato.com\/blog\/quick-qlik-survey\/<\/a><\/p>\n\n\n\n<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<\/p>\n\n\n\n<p>Variables are really useful in Qlik. If you wish to create groups based in thresholds, this could be a good way to go.<\/p>\n\n\n\n<p>In the video below I show how to group Countries (for example) based on dynamic values, creating a new dimension that will be using variables to calculate which countries are in which group.<\/p>\n\n\n\n<p>You can download the qvf in the link <a href=\"https:\/\/approbato.com\/files\/VariablesandGroups.qvf\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/approbato.com\/files\/VariablesandGroups.qvf<\/a><\/p>\n\n\n\n<p>Basically we can apply conditions to verify if a Country belong to a cluster:<\/p>\n\n\n\n<p>If Population&gt; X and GDP &gt;Y , then it belong to Group 1, If not&#8230;. (and so on)<\/p>\n\n\n\n<p>We use the Aggr function. Below is the video and the Aggr formula used in this example.<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"Qlik Sense - Create dynamic groups using variables (qvf for download)\" width=\"640\" height=\"360\" src=\"https:\/\/www.youtube.com\/embed\/BJ64C4-xVZ4?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n\n\n\n<p>After creating the vX and vY variables, we can use the expression below:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Aggr(\nif(\n   Sum(GDP)&gt;$(vX)  and Sum(Population)&gt;$(vY)\n,\n   'Q1' ,\n\n   if(\n      Sum(GDP)&lt;=$(vX)  and Sum(Population)&gt;$(vY)\n,\n      'Q2' ,\n       \n      if(\n      Sum(GDP)&gt;$(vX)  and Sum(Population)&lt;=$(vY)\n,\n          'Q3' ,\n      'Q4')))\n,Country)\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Variables are really useful in Qlik. If you wish to create groups based in thresholds, this could be a good way to go.<\/p>\n","protected":false},"author":1,"featured_media":180,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[14,2],"tags":[18,9],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.2.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Create groups based on metrics (and change it with variables) - Guilherme Approbato<\/title>\n<meta name=\"description\" content=\"Mastering Qlik: How to use the Aggr function in Qlik to create groups based in metrics, and change the groups using variables.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/approbato.com\/blog\/create-groups-based-on-metrics-and-change-it-with-variables\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Create groups based on metrics (and change it with variables) - Guilherme Approbato\" \/>\n<meta property=\"og:description\" content=\"Mastering Qlik: How to use the Aggr function in Qlik to create groups based in metrics, and change the groups using variables.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/approbato.com\/blog\/create-groups-based-on-metrics-and-change-it-with-variables\/\" \/>\n<meta property=\"og:site_name\" content=\"Guilherme Approbato\" \/>\n<meta property=\"article:published_time\" content=\"2021-11-18T22:36:56+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-08-04T18:57:08+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/approbato.com\/blog\/wp-content\/uploads\/2021\/11\/Record_2021_11_17_23_58_38_91.gif\" \/>\n\t<meta property=\"og:image:width\" content=\"1335\" \/>\n\t<meta property=\"og:image:height\" content=\"546\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/gif\" \/>\n<meta name=\"author\" content=\"Guilherme Approbato\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Guilherme Approbato\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/approbato.com\/blog\/create-groups-based-on-metrics-and-change-it-with-variables\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/approbato.com\/blog\/create-groups-based-on-metrics-and-change-it-with-variables\/\"},\"author\":{\"name\":\"Guilherme Approbato\",\"@id\":\"https:\/\/approbato.com\/blog\/#\/schema\/person\/64f139096656d0884d037457309f9c75\"},\"headline\":\"Create groups based on metrics (and change it with variables)\",\"datePublished\":\"2021-11-18T22:36:56+00:00\",\"dateModified\":\"2022-08-04T18:57:08+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/approbato.com\/blog\/create-groups-based-on-metrics-and-change-it-with-variables\/\"},\"wordCount\":186,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/approbato.com\/blog\/#\/schema\/person\/64f139096656d0884d037457309f9c75\"},\"keywords\":[\"Aggr\",\"Variables\"],\"articleSection\":[\"English\",\"Qlik\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/approbato.com\/blog\/create-groups-based-on-metrics-and-change-it-with-variables\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/approbato.com\/blog\/create-groups-based-on-metrics-and-change-it-with-variables\/\",\"url\":\"https:\/\/approbato.com\/blog\/create-groups-based-on-metrics-and-change-it-with-variables\/\",\"name\":\"Create groups based on metrics (and change it with variables) - Guilherme Approbato\",\"isPartOf\":{\"@id\":\"https:\/\/approbato.com\/blog\/#website\"},\"datePublished\":\"2021-11-18T22:36:56+00:00\",\"dateModified\":\"2022-08-04T18:57:08+00:00\",\"description\":\"Mastering Qlik: How to use the Aggr function in Qlik to create groups based in metrics, and change the groups using variables.\",\"breadcrumb\":{\"@id\":\"https:\/\/approbato.com\/blog\/create-groups-based-on-metrics-and-change-it-with-variables\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/approbato.com\/blog\/create-groups-based-on-metrics-and-change-it-with-variables\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/approbato.com\/blog\/create-groups-based-on-metrics-and-change-it-with-variables\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/approbato.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Create groups based on metrics (and change it with variables)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/approbato.com\/blog\/#website\",\"url\":\"https:\/\/approbato.com\/blog\/\",\"name\":\"Guilherme Approbato\",\"description\":\"Management Consulting | Certified Qlik Data Architect and Business Analyst\",\"publisher\":{\"@id\":\"https:\/\/approbato.com\/blog\/#\/schema\/person\/64f139096656d0884d037457309f9c75\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/approbato.com\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/approbato.com\/blog\/#\/schema\/person\/64f139096656d0884d037457309f9c75\",\"name\":\"Guilherme Approbato\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/approbato.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"http:\/\/approbato.com\/blog\/wp-content\/uploads\/2020\/10\/guilherme-96x96.jpg\",\"contentUrl\":\"http:\/\/approbato.com\/blog\/wp-content\/uploads\/2020\/10\/guilherme-96x96.jpg\",\"caption\":\"Guilherme Approbato\"},\"logo\":{\"@id\":\"https:\/\/approbato.com\/blog\/#\/schema\/person\/image\/\"},\"sameAs\":[\"http:\/\/approbato.com\/blog\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Create groups based on metrics (and change it with variables) - Guilherme Approbato","description":"Mastering Qlik: How to use the Aggr function in Qlik to create groups based in metrics, and change the groups using variables.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/approbato.com\/blog\/create-groups-based-on-metrics-and-change-it-with-variables\/","og_locale":"en_US","og_type":"article","og_title":"Create groups based on metrics (and change it with variables) - Guilherme Approbato","og_description":"Mastering Qlik: How to use the Aggr function in Qlik to create groups based in metrics, and change the groups using variables.","og_url":"https:\/\/approbato.com\/blog\/create-groups-based-on-metrics-and-change-it-with-variables\/","og_site_name":"Guilherme Approbato","article_published_time":"2021-11-18T22:36:56+00:00","article_modified_time":"2022-08-04T18:57:08+00:00","og_image":[{"width":1335,"height":546,"url":"http:\/\/approbato.com\/blog\/wp-content\/uploads\/2021\/11\/Record_2021_11_17_23_58_38_91.gif","type":"image\/gif"}],"author":"Guilherme Approbato","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Guilherme Approbato","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/approbato.com\/blog\/create-groups-based-on-metrics-and-change-it-with-variables\/#article","isPartOf":{"@id":"https:\/\/approbato.com\/blog\/create-groups-based-on-metrics-and-change-it-with-variables\/"},"author":{"name":"Guilherme Approbato","@id":"https:\/\/approbato.com\/blog\/#\/schema\/person\/64f139096656d0884d037457309f9c75"},"headline":"Create groups based on metrics (and change it with variables)","datePublished":"2021-11-18T22:36:56+00:00","dateModified":"2022-08-04T18:57:08+00:00","mainEntityOfPage":{"@id":"https:\/\/approbato.com\/blog\/create-groups-based-on-metrics-and-change-it-with-variables\/"},"wordCount":186,"commentCount":0,"publisher":{"@id":"https:\/\/approbato.com\/blog\/#\/schema\/person\/64f139096656d0884d037457309f9c75"},"keywords":["Aggr","Variables"],"articleSection":["English","Qlik"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/approbato.com\/blog\/create-groups-based-on-metrics-and-change-it-with-variables\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/approbato.com\/blog\/create-groups-based-on-metrics-and-change-it-with-variables\/","url":"https:\/\/approbato.com\/blog\/create-groups-based-on-metrics-and-change-it-with-variables\/","name":"Create groups based on metrics (and change it with variables) - Guilherme Approbato","isPartOf":{"@id":"https:\/\/approbato.com\/blog\/#website"},"datePublished":"2021-11-18T22:36:56+00:00","dateModified":"2022-08-04T18:57:08+00:00","description":"Mastering Qlik: How to use the Aggr function in Qlik to create groups based in metrics, and change the groups using variables.","breadcrumb":{"@id":"https:\/\/approbato.com\/blog\/create-groups-based-on-metrics-and-change-it-with-variables\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/approbato.com\/blog\/create-groups-based-on-metrics-and-change-it-with-variables\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/approbato.com\/blog\/create-groups-based-on-metrics-and-change-it-with-variables\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/approbato.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Create groups based on metrics (and change it with variables)"}]},{"@type":"WebSite","@id":"https:\/\/approbato.com\/blog\/#website","url":"https:\/\/approbato.com\/blog\/","name":"Guilherme Approbato","description":"Management Consulting | Certified Qlik Data Architect and Business Analyst","publisher":{"@id":"https:\/\/approbato.com\/blog\/#\/schema\/person\/64f139096656d0884d037457309f9c75"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/approbato.com\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/approbato.com\/blog\/#\/schema\/person\/64f139096656d0884d037457309f9c75","name":"Guilherme Approbato","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/approbato.com\/blog\/#\/schema\/person\/image\/","url":"http:\/\/approbato.com\/blog\/wp-content\/uploads\/2020\/10\/guilherme-96x96.jpg","contentUrl":"http:\/\/approbato.com\/blog\/wp-content\/uploads\/2020\/10\/guilherme-96x96.jpg","caption":"Guilherme Approbato"},"logo":{"@id":"https:\/\/approbato.com\/blog\/#\/schema\/person\/image\/"},"sameAs":["http:\/\/approbato.com\/blog"]}]}},"_links":{"self":[{"href":"https:\/\/approbato.com\/blog\/wp-json\/wp\/v2\/posts\/178"}],"collection":[{"href":"https:\/\/approbato.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/approbato.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/approbato.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/approbato.com\/blog\/wp-json\/wp\/v2\/comments?post=178"}],"version-history":[{"count":4,"href":"https:\/\/approbato.com\/blog\/wp-json\/wp\/v2\/posts\/178\/revisions"}],"predecessor-version":[{"id":216,"href":"https:\/\/approbato.com\/blog\/wp-json\/wp\/v2\/posts\/178\/revisions\/216"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/approbato.com\/blog\/wp-json\/wp\/v2\/media\/180"}],"wp:attachment":[{"href":"https:\/\/approbato.com\/blog\/wp-json\/wp\/v2\/media?parent=178"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/approbato.com\/blog\/wp-json\/wp\/v2\/categories?post=178"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/approbato.com\/blog\/wp-json\/wp\/v2\/tags?post=178"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}