<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to do a calculated dimension based on a measure in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/How-to-do-a-calculated-dimension-based-on-a-measure/m-p/1611800#M45481</link>
    <description>&lt;P&gt;Hi Mplautz&lt;/P&gt;&lt;P&gt;Use Aggr in a dimension&lt;/P&gt;&lt;P&gt;aggr (&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; //start aggr&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;if (measure &amp;gt;= 0.5,'Yes','No'&lt;/EM&gt;&lt;/STRONG&gt; )&amp;nbsp; //if statement&lt;/P&gt;&lt;P&gt;,Geo,Account,SalesRep)&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //one or more fields to aggr by&lt;/P&gt;&lt;P&gt;Then you can filter by the Yes No results&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 13 Aug 2019 02:11:37 GMT</pubDate>
    <dc:creator>robert99</dc:creator>
    <dc:date>2019-08-13T02:11:37Z</dc:date>
    <item>
      <title>How to do a calculated dimension based on a measure</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-do-a-calculated-dimension-based-on-a-measure/m-p/1611768#M45478</link>
      <description>&lt;P&gt;So I will start by being clear that I know that QlikSense ≠ Microsoft Excel.&lt;/P&gt;&lt;P&gt;BUT&lt;/P&gt;&lt;P&gt;I was wondering how to recreate some of this functionality on a table within a Sheet inside of a Qlik app. Basically, I would like to have a dimension on a table that is based on a measure earlier on in the table.&amp;nbsp;&lt;/P&gt;&lt;P&gt;For simplicity's sake, consider this table, with the following columns:&lt;/P&gt;&lt;P&gt;Column Name Column Type&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Geo&lt;/TD&gt;&lt;TD&gt;Dimension&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Account&lt;/TD&gt;&lt;TD&gt;Dimension&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Sales Rep&lt;/TD&gt;&lt;TD&gt;Dimension&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;QTD Revenue&lt;/TD&gt;&lt;TD&gt;Measure&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;% of Target&lt;/TD&gt;&lt;TD&gt;Measure&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;Let's say now that I add a sixth column, called "Halfway", which is a dimension. It is based on the fifth column (i.e. the second measure), and would have a calculation like this:&lt;/P&gt;&lt;PRE&gt;=if(column(2) &amp;gt;= .5, 'Yes', 'No')&lt;/PRE&gt;&lt;P&gt;Then, I could set a filter on this "Halfway" dimension for all those where "Halfway" = "Yes", as well as likewise where it equals "No".&amp;nbsp; This is something I can do with ease in Excel.&lt;/P&gt;&lt;P&gt;Well if I try to do this, it is as if column(2) is null.&lt;/P&gt;&lt;P&gt;Now, I understand the inherent problem with this, and that is that&amp;nbsp;&lt;EM&gt;all measures are based on dimension&lt;/EM&gt;&lt;EM&gt;s&lt;/EM&gt;, and how fine a measure breaks down depends on the dimensions surrounding it. So, maybe what I want to do is not possible. But that's not good enough, and I don't like that.&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Well, what if you just make it a measure instead?&lt;/EM&gt; Well I could. I could rewrite column six as a measure where it is either 1 or 0 based on whether or not it is halfway, and I would use a formula like this:&lt;/P&gt;&lt;PRE&gt;=round(column(2))&lt;/PRE&gt;&lt;P&gt;That would work brilliantly. The only problem is&amp;nbsp;&lt;STRONG&gt;Now I can't filter on it!&lt;/STRONG&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there anything, even an extension that anyone knows of, or maybe a totally different way of approaching this, that allows me to have a filterable dimension field based on a measure?&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 04:59:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-do-a-calculated-dimension-based-on-a-measure/m-p/1611768#M45478</guid>
      <dc:creator>mplautz</dc:creator>
      <dc:date>2024-11-16T04:59:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to do a calculated dimension based on a measure</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-do-a-calculated-dimension-based-on-a-measure/m-p/1611800#M45481</link>
      <description>&lt;P&gt;Hi Mplautz&lt;/P&gt;&lt;P&gt;Use Aggr in a dimension&lt;/P&gt;&lt;P&gt;aggr (&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; //start aggr&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;if (measure &amp;gt;= 0.5,'Yes','No'&lt;/EM&gt;&lt;/STRONG&gt; )&amp;nbsp; //if statement&lt;/P&gt;&lt;P&gt;,Geo,Account,SalesRep)&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //one or more fields to aggr by&lt;/P&gt;&lt;P&gt;Then you can filter by the Yes No results&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Aug 2019 02:11:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-do-a-calculated-dimension-based-on-a-measure/m-p/1611800#M45481</guid>
      <dc:creator>robert99</dc:creator>
      <dc:date>2019-08-13T02:11:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to do a calculated dimension based on a measure</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-do-a-calculated-dimension-based-on-a-measure/m-p/1612110#M45517</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/14696"&gt;@robert99&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;/P&gt;&lt;P&gt;This solution is brilliant. I'm so glad it was this simple. There are two comments I have that perhaps you may be able to address:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;In your example, you reference&amp;nbsp;&lt;EM&gt;measure&lt;/EM&gt;. If I try to put&amp;nbsp;&lt;EM&gt;column(2)&lt;/EM&gt; in place of measure, it does not appear to work. Still not even if I put&amp;nbsp;&lt;EM&gt;num(column(2))&lt;/EM&gt;. By "it does not work", I mean I get the same result as not having &lt;EM&gt;aggr&lt;/EM&gt; at all – it is as if &lt;EM&gt;measure&amp;nbsp;&lt;/EM&gt;is just equating to&amp;nbsp;&lt;EM&gt;null&lt;/EM&gt;.&amp;nbsp;However, if I put the full formula that calculated&amp;nbsp;&lt;EM&gt;measure&lt;/EM&gt; in its place, then it works. In this case, I'd have to substitute the entire formula that comprised the % of Target measure. Do you know if I&amp;nbsp;&lt;EM&gt;should&lt;/EM&gt; be able to use the "column" function? Or is this something that is not supported? If not, I can work through it.&lt;/LI&gt;&lt;LI&gt;When I use your example, I am only getting "Yes" values, and all "No" values are displaying as a hyphen (-), or what I understand to be&amp;nbsp;&lt;EM&gt;null&lt;/EM&gt;. If I test for&amp;nbsp;&lt;EM&gt;measure&lt;/EM&gt; to be null by wrapping an&amp;nbsp;&lt;EM&gt;if(isnull(measure), "N", ...)&lt;/EM&gt; around the "if statement" portion of the formula, I still get the hypen (-) in my data. Ultimately, the field will be binary, either "Y" or "N", and technically "Y" or "-" is still binary, but this will be problematic, as I do not know of a way to select only "null" values. Is there something I need to do differently to show cases where&amp;nbsp;&lt;EM&gt;measure&amp;nbsp;&lt;/EM&gt;is equal to 0 so it does not show as nulls? Or perhaps another question, is there a way to select only&amp;nbsp;&lt;EM&gt;null&lt;/EM&gt; values in a dimension?&lt;/LI&gt;&lt;/OL&gt;</description>
      <pubDate>Tue, 13 Aug 2019 17:32:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-do-a-calculated-dimension-based-on-a-measure/m-p/1612110#M45517</guid>
      <dc:creator>mplautz</dc:creator>
      <dc:date>2019-08-13T17:32:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to do a calculated dimension based on a measure</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-do-a-calculated-dimension-based-on-a-measure/m-p/1612169#M45521</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/57851"&gt;@mplautz&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It should give you both Yes and No. Have you played around with the aggr dimension. For example change the order. Or add more or less dimensions.&amp;nbsp; I try to avoid using aggr but at times I have no choice. But it can be tricky to get it right. So you might need to use&lt;/P&gt;&lt;P&gt;aggr (&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; //start aggr&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;if (measure &amp;gt;= 0.5,'Yes','No'&lt;/EM&gt;&lt;/STRONG&gt; )&amp;nbsp; //if statement&lt;/P&gt;&lt;P&gt;,Geo)&amp;nbsp;&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;Use Aggr in a dimension&lt;/P&gt;&lt;P&gt;aggr (&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; //start aggr&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;if (measure &amp;gt;= 0.5,'Yes','No'&lt;/EM&gt;&lt;/STRONG&gt; )&amp;nbsp; //if statement&lt;/P&gt;&lt;P&gt;,Geo,Account,SubAccount, SalesRep)&amp;nbsp;&amp;nbsp; //usually it corresponds to the table used. So if you have 5 dimensions in the table use the same 5 dimensions. But not always I think (or maybe not in this situation - I rarely use aggr in dimensions)&lt;/P&gt;&lt;P&gt;aggr is a separate calculation that is done to produce a sub-table (rather than setting up the table in script. If possible this is my preferred option). That is then used in the measure. But it can also be used to produce a filter dimension field.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Aug 2019 20:04:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-do-a-calculated-dimension-based-on-a-measure/m-p/1612169#M45521</guid>
      <dc:creator>robert99</dc:creator>
      <dc:date>2019-08-13T20:04:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to do a calculated dimension based on a measure</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-do-a-calculated-dimension-based-on-a-measure/m-p/1612176#M45522</link>
      <description>&lt;P&gt;Still not even if I put&amp;nbsp;&lt;EM&gt;num(column(2))&lt;/EM&gt;. By "it does not work",&lt;/P&gt;&lt;P&gt;I started using column(2) etc but stopped. I now just copy and paste the measure.&lt;/P&gt;&lt;P&gt;But another option is to use variables and I believe Qlik is happy with this option for now. But they have master measures and hopefully one day they will allow them to be used in dimensions (using aggr), colouring, other measures etc as if they were set up in script. But this might be a big change. But see how using a variable goes&lt;/P&gt;&lt;P&gt;Re nulls. There are a number of articles on this (Henric has a good one). But I tend to use mapping load if possible. I really dislike being unable to filter on nulls.&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/t5/Qlik-Design-Blog/Finding-NULL/ba-p/1474279" target="_blank"&gt;https://community.qlik.com/t5/Qlik-Design-Blog/Finding-NULL/ba-p/1474279&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Aug 2019 20:22:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-do-a-calculated-dimension-based-on-a-measure/m-p/1612176#M45522</guid>
      <dc:creator>robert99</dc:creator>
      <dc:date>2019-08-13T20:22:13Z</dc:date>
    </item>
  </channel>
</rss>

