<?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 reference a field in the current row of a straight table in a set analysis. in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/How-to-reference-a-field-in-the-current-row-of-a-straight-table/m-p/1885321#M72914</link>
    <description>&lt;P&gt;Set Analysis can't vary by chart row, because the set is computed only once, before the chart is calculated. If you want to do a row-by-row thing, you have to use If().&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;Sum(If(PlannedDate &amp;lt;= Today()+[Lead time], [Planned Quantity]))&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;-Rob&lt;BR /&gt;&lt;A href="http://www.easyqlik.com" target="_blank"&gt;http://www.easyqlik.com&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://masterssummit.com" target="_blank"&gt;http://masterssummit.com&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://qlikviewcookbook.com" target="_blank"&gt;http://qlikviewcookbook.com&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 25 Jan 2022 22:22:39 GMT</pubDate>
    <dc:creator>rwunderlich</dc:creator>
    <dc:date>2022-01-25T22:22:39Z</dc:date>
    <item>
      <title>How to reference a field in the current row of a straight table in a set analysis.</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-reference-a-field-in-the-current-row-of-a-straight-table/m-p/1885305#M72912</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;
&lt;P&gt;I'm trying to reference a field in the current / same row of a straight table in a set analysis.&lt;/P&gt;
&lt;P&gt;To make this easy to understand I have two tables:&lt;BR /&gt;- Planned purchase orders (ItemID, PlannedDate, Quantity)&lt;BR /&gt;- Supplier items with lead time (ItemID, ItemCode, ItemDescription, Supplier, Lead time). Multiple suppliers per item are possible, but for now that's not an issue.&lt;/P&gt;
&lt;P&gt;Now I'm trying to calculate in a straight table the quantity to be received within the lead time of the supplier.&lt;/P&gt;
&lt;P&gt;Straigth table has the following columns:&lt;BR /&gt;- ItemCode&lt;BR /&gt;- ItemDescription&lt;BR /&gt;- Supplier&lt;BR /&gt;- Lead time&lt;BR /&gt;- Total in order -&amp;gt; Sum([Planned Quantity])&lt;BR /&gt;- In order between today and lead time date -&amp;gt; I can't get this to work&lt;/P&gt;
&lt;P&gt;I've tried several things.&lt;/P&gt;
&lt;P&gt;Sum({&amp;lt;PlannedDate={"&amp;lt;=$(=Date(Today()+[Lead time]))"}&amp;gt;} [Planned Quantity]) doesn't work.&lt;/P&gt;
&lt;P&gt;It seems like [Lead time] refers to all values of [Lead time] in the table, because after experimenting with Min() and Max() based on other topics on the community it shows a date in the expression. Not the date I want, but at least a date.&lt;/P&gt;
&lt;P&gt;Sum({&amp;lt;PlannedDate={""&amp;lt;=$(=Date(Today()+Min([Lead time])))"}&amp;gt;} [Planned Quantity])&lt;/P&gt;
&lt;P&gt;But I want to use [Lead time] of the current row of the table.&lt;/P&gt;
&lt;P&gt;Any ideas?&lt;BR /&gt;Thanks in advance!&lt;/P&gt;
&lt;P&gt;Kind regards,&lt;/P&gt;
&lt;P&gt;Sebb.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jan 2022 21:17:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-reference-a-field-in-the-current-row-of-a-straight-table/m-p/1885305#M72912</guid>
      <dc:creator>SBDataspark</dc:creator>
      <dc:date>2022-01-25T21:17:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to reference a field in the current row of a straight table in a set analysis.</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-reference-a-field-in-the-current-row-of-a-straight-table/m-p/1885321#M72914</link>
      <description>&lt;P&gt;Set Analysis can't vary by chart row, because the set is computed only once, before the chart is calculated. If you want to do a row-by-row thing, you have to use If().&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;Sum(If(PlannedDate &amp;lt;= Today()+[Lead time], [Planned Quantity]))&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;-Rob&lt;BR /&gt;&lt;A href="http://www.easyqlik.com" target="_blank"&gt;http://www.easyqlik.com&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://masterssummit.com" target="_blank"&gt;http://masterssummit.com&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://qlikviewcookbook.com" target="_blank"&gt;http://qlikviewcookbook.com&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jan 2022 22:22:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-reference-a-field-in-the-current-row-of-a-straight-table/m-p/1885321#M72914</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2022-01-25T22:22:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to reference a field in the current row of a straight table in a set analysis.</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-reference-a-field-in-the-current-row-of-a-straight-table/m-p/1885468#M72925</link>
      <description>&lt;P&gt;Thank you for your explanation Rob. Really appreciate it!!&lt;/P&gt;
&lt;P&gt;The "PlannedDate" isn't a dimension/measurement/column/value in the straight table that I'm creating.&lt;BR /&gt;But I see in the result of your expression that I can do an if statement on the value anyway.&lt;BR /&gt;That's good to know...&lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;As always this was a bit of simplification of the problem I was facing.&lt;/P&gt;
&lt;P&gt;In the straight table I can have two suppliers for the same item.&lt;BR /&gt;Supplier 1 and Supplier 2.&lt;BR /&gt;Now I only want to show the [Planned Quantity] next to Supplier 1 that I've ordered the products from.&lt;/P&gt;
&lt;P&gt;With the expression&amp;nbsp;&lt;STRONG&gt;Sum(If(PlannedDate &amp;lt;= Today()+[Lead time], [Planned Quantity]))&lt;/STRONG&gt;&lt;SPAN&gt; it shows the amount next to both suppliers. Which is correct based on the contents of the expression.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I've tried with a couple of aggr sum expressions, but can't get the right result.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Aggr(Sum(If([PlannedDate] &amp;lt;= Today() + [Leadt time], [Planned Quantity])), ItemCode, ItemDescription, Supplier)&lt;/STRONG&gt;&lt;BR /&gt;still shows the quantity for both suppliers.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Sebb_1-1643192406765.png" style="width: 707px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/70998iF500920458FB8E13/image-dimensions/707x134?v=v2" width="707" height="134" role="button" title="Sebb_1-1643192406765.png" alt="Sebb_1-1643192406765.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Aggr(Aggr(Sum(If([PlannedDate] &amp;lt;= Today() + [Leadt time], [Planned Quantity])), ItemCode, ItemDescription), Supplier)&lt;/STRONG&gt;&lt;BR /&gt;shows me the quantity x 2 in the column of the right supplier.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Sebb_0-1643192344372.png" style="width: 714px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/70997i2348D91183FFC2BF/image-dimensions/714x156?v=v2" width="714" height="156" role="button" title="Sebb_0-1643192344372.png" alt="Sebb_0-1643192344372.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;But I don't want to divide by 2, just for the sake of it. I'd like to show it correctly with the right expression...&lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;When I was creating this post I fiddled some more and ended up with the following expression.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Aggr(Aggr(Sum(If([PlannedDate] &amp;lt;= Today() + [Leadt time], [Planned Quantity])), ItemCode, ItemDescription, Supplier), [Planned Quantity])&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Sebb_3-1643192670097.png" style="width: 707px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/71000iE50EF0CB100EF1C3/image-dimensions/707x152?v=v2" width="707" height="152" role="button" title="Sebb_3-1643192670097.png" alt="Sebb_3-1643192670097.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;As you can see this gives me the right results. I don't know exactly why...&lt;span class="lia-unicode-emoji" title=":rolling_on_the_floor_laughing:"&gt;🤣&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Would you be so kind as to maybe explain why this works?&lt;/P&gt;
&lt;P&gt;Thanks again!!&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jan 2022 10:27:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-reference-a-field-in-the-current-row-of-a-straight-table/m-p/1885468#M72925</guid>
      <dc:creator>SBDataspark</dc:creator>
      <dc:date>2022-01-26T10:27:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to reference a field in the current row of a straight table in a set analysis.</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-reference-a-field-in-the-current-row-of-a-straight-table/m-p/1885518#M72931</link>
      <description>&lt;P&gt;Oh, by the way this expression only works when I make a selection on Items and it doesn't work without a selection.&lt;BR /&gt;Need to fiddle some more to get lucky to get it to work when there's no selection made...&lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jan 2022 12:30:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-reference-a-field-in-the-current-row-of-a-straight-table/m-p/1885518#M72931</guid>
      <dc:creator>SBDataspark</dc:creator>
      <dc:date>2022-01-26T12:30:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to reference a field in the current row of a straight table in a set analysis.</title>
      <link>https://community.qlik.com/t5/App-Development/How-to-reference-a-field-in-the-current-row-of-a-straight-table/m-p/1886681#M73044</link>
      <description>&lt;P&gt;In the end I had to change the data model to suite some other requirements.&lt;BR /&gt;While loading the stock planning lines I added the following in the load script:&lt;/P&gt;
&lt;P&gt;If(PlannedDate &amp;lt;= (Today() + [LeadTime]), 1, 0) as [WithinLeadTimeFlag]&lt;/P&gt;
&lt;P&gt;And created the following set expression:&lt;/P&gt;
&lt;P&gt;Sum({$&amp;lt;[Planningtype]={'PurchaseOrder'}, WithinLeadTimeFlag={1}&amp;gt;} [Planned amount])&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jan 2022 19:28:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/How-to-reference-a-field-in-the-current-row-of-a-straight-table/m-p/1886681#M73044</guid>
      <dc:creator>SBDataspark</dc:creator>
      <dc:date>2022-01-28T19:28:05Z</dc:date>
    </item>
  </channel>
</rss>

