<?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: using columnno() inside sum() in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/using-columnno-inside-sum/m-p/1242382#M24683</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I got a solution, which is doing the work:&lt;/P&gt;&lt;P&gt;Measure Calculation:&lt;/P&gt;&lt;P style="text-indent: 36.0pt;"&gt;if( $(vFinalCalc) &amp;gt; 0, $(vFinalCalc), 7 * (104 - ColumnNo()))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Loadscript:&lt;/P&gt;&lt;P style="text-indent: 36.0pt;"&gt;for i = 1 To 104;&lt;/P&gt;&lt;P style="text-indent: 36.0pt;"&gt;&amp;nbsp;&amp;nbsp; let i2 = i + 1;&lt;/P&gt;&lt;P style="text-indent: 36.0pt;"&gt;&amp;nbsp;&amp;nbsp; let l$(i) = 'sum(SOH) - rangesum(after(Sum(TD),1,$(i2))) &amp;lt;= 0'; &lt;/P&gt;&lt;P style="text-indent: 36.0pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; let r$(i) = 'round((sum(SOH) - rangesum(after(Sum(TD),1,$(i)))) / ((sum(SOH) - rangesum(after(Sum(TD),1,$(i))))-(sum(SOH) - rangesum(after(Sum(TD),1,$(i2)))))*7)';&lt;/P&gt;&lt;P style="text-indent: 36.0pt;"&gt;&amp;nbsp;&amp;nbsp; let vOneRowCalcLeft = vOneRowCalcLeft &amp;amp; ',' &amp;amp; chr(36) &amp;amp; '(l' &amp;amp; $(i) &amp;amp; ')';&lt;/P&gt;&lt;P style="text-indent: 36.0pt;"&gt;&amp;nbsp;&amp;nbsp; let vOneRowCalcRight = vOneRowCalcRight &amp;amp; ',' &amp;amp; chr(36) &amp;amp; '(r' &amp;amp; $(i) &amp;amp; ')';&lt;/P&gt;&lt;P style="text-indent: 36.0pt;"&gt;Next&lt;/P&gt;&lt;P style="text-indent: 36.0pt;"&gt;let vFinalCalc = 'match(-1 $(vOneRowCalcLeft)) * 7 + pick(match(-1 $(vOneRowCalcLeft)) $(vOneRowCalcRight))';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;THX for the help!!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 15 Nov 2016 10:22:16 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2016-11-15T10:22:16Z</dc:date>
    <item>
      <title>using columnno() inside sum()</title>
      <link>https://community.qlik.com/t5/App-Development/using-columnno-inside-sum/m-p/1242376#M24677</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have column with enumerating names: c1, c2, c3...&lt;/P&gt;&lt;P&gt;In the sum aggregation I would like to address these columns with a function like this:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #808080; font-family: 'courier new', courier; font-size: 13px;"&gt;sum($(='[c&lt;/SPAN&gt;&lt;SPAN style="font-size: 13px; font-family: 'courier new', courier; color: #808080;"&gt;' &amp;amp; ColumnNo() &amp;amp;'&lt;/SPAN&gt;&lt;SPAN style="color: #808080; font-family: 'courier new', courier; font-size: 13px;"&gt;]')&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I cannot find out the correct synthax.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Roland&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 13 Nov 2016 07:49:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/using-columnno-inside-sum/m-p/1242376#M24677</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-11-13T07:49:28Z</dc:date>
    </item>
    <item>
      <title>Re: using columnno() inside sum()</title>
      <link>https://community.qlik.com/t5/App-Development/using-columnno-inside-sum/m-p/1242377#M24678</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Roland,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you explain what you are trying to achieve? With some example.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Kaushik Solanki&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 13 Nov 2016 07:51:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/using-columnno-inside-sum/m-p/1242377#M24678</guid>
      <dc:creator>kaushiknsolanki</dc:creator>
      <dc:date>2016-11-13T07:51:20Z</dc:date>
    </item>
    <item>
      <title>Re: using columnno() inside sum()</title>
      <link>https://community.qlik.com/t5/App-Development/using-columnno-inside-sum/m-p/1242378#M24679</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;having a load table with&lt;/P&gt;&lt;P&gt;week,&lt;/P&gt;&lt;P&gt;mat,&lt;/P&gt;&lt;P&gt;price,&lt;/P&gt;&lt;P&gt;calcprice1,&lt;/P&gt;&lt;P&gt;calcprice2,&lt;/P&gt;&lt;P&gt;calcprice3&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;calcprice104&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in a pivot I have&lt;/P&gt;&lt;P&gt;Dimensions:&lt;/P&gt;&lt;P&gt;mat&lt;/P&gt;&lt;P&gt;&amp;lt;MEASURES&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Columns:&lt;/P&gt;&lt;P&gt;week&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MEASURES:&lt;/P&gt;&lt;P&gt;Measure1: sum(price)&lt;/P&gt;&lt;P&gt;Measure2: if (&lt;SPAN style="font-size: 13px; font-family: 'courier new', courier; color: #808080;"&gt;sum($(='[calcprice&lt;/SPAN&gt;&lt;SPAN style="font-size: 13px; font-family: 'courier new', courier; color: #808080;"&gt;' &amp;amp; ColumnNo() &amp;amp;'&lt;/SPAN&gt;&lt;SPAN style="font-size: 13px; font-family: 'courier new', courier; color: #808080;"&gt;]')) &amp;lt;= 0, 7 * ColumnNo() + something, 999)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this is working:&lt;/P&gt;&lt;P&gt;if (&lt;SPAN style="font-size: 13px; font-family: 'courier new', courier; color: #808080;"&gt;sum(calcprice1&lt;/SPAN&gt;&lt;SPAN style="font-size: 13px; font-family: 'courier new', courier; color: #808080;"&gt;) &amp;lt;= 0, 7 * ColumnNo(),&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;if (&lt;SPAN style="font-size: 13px; font-family: 'courier new', courier; color: #808080;"&gt;sum(calcprice2&lt;/SPAN&gt;&lt;SPAN style="font-size: 13px; font-family: 'courier new', courier; color: #808080;"&gt;) &amp;lt;= 0, 7 * ColumnNo(),&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;if (&lt;SPAN style="font-size: 13px; font-family: 'courier new', courier; color: #808080;"&gt;sum(calcprice3&lt;/SPAN&gt;&lt;SPAN style="font-size: 13px; font-family: 'courier new', courier; color: #808080;"&gt;) &amp;lt;= 0, 7 * ColumnNo(), 999)))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;But, because I have to do it 104 times it would be a big if statement and I found out, &lt;/P&gt;&lt;P&gt;that there is a limitation of 96 nested IFs...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also tried&amp;nbsp; &lt;SPAN style="font-size: 13px; font-family: 'courier new', courier; color: #808080;"&gt;sum($(='[calcprice&lt;/SPAN&gt;&lt;SPAN style="font-size: 13px; font-family: 'courier new', courier; color: #808080;"&gt;' &amp;amp; $(=ColumnNo()) &amp;amp;'&lt;/SPAN&gt;&lt;SPAN style="font-size: 13px; font-family: 'courier new', courier; color: #808080;"&gt;]'))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13px; font-family: 'courier new', courier; color: #808080;"&gt;and: &lt;SPAN style="font-size: 13px; font-family: 'courier new', courier; color: #808080;"&gt;sum($(='calcprice&lt;/SPAN&gt;&lt;SPAN style="font-size: 13px; font-family: 'courier new', courier; color: #808080;"&gt;' &amp;amp; $(=ColumnNo()&lt;/SPAN&gt;&lt;SPAN style="font-size: 13px; font-family: 'courier new', courier; color: #808080;"&gt;))&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 13 Nov 2016 09:21:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/using-columnno-inside-sum/m-p/1242378#M24679</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-11-13T09:21:42Z</dc:date>
    </item>
    <item>
      <title>Re: using columnno() inside sum()</title>
      <link>https://community.qlik.com/t5/App-Development/using-columnno-inside-sum/m-p/1242379#M24680</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try with nested expression with the variables also this will decrease your expression word length.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ex:- &lt;/P&gt;&lt;P&gt;$(vExpr1)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;$(vExpr2)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Anand&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 13 Nov 2016 10:43:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/using-columnno-inside-sum/m-p/1242379#M24680</guid>
      <dc:creator>its_anandrjs</dc:creator>
      <dc:date>2016-11-13T10:43:38Z</dc:date>
    </item>
    <item>
      <title>Re: using columnno() inside sum()</title>
      <link>https://community.qlik.com/t5/App-Development/using-columnno-inside-sum/m-p/1242380#M24681</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Perhaps something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=pick(match(-1,$(=concat('sum([' &amp;amp; 'calcprice' &amp;amp; valueloop(1,104) &amp;amp; ']) &amp;lt;=0',', ', valueloop(1,104))),-1),$(=concat( '7*ColumnNo()',',', valueloop(1,104))),999)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sillytricksdepartment‌&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 13 Nov 2016 10:47:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/using-columnno-inside-sum/m-p/1242380#M24681</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2016-11-13T10:47:00Z</dc:date>
    </item>
    <item>
      <title>Re: using columnno() inside sum()</title>
      <link>https://community.qlik.com/t5/App-Development/using-columnno-inside-sum/m-p/1242381#M24682</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, &lt;/P&gt;&lt;P&gt;great, will check that tomorrow... did not know, that something like valueloop exists...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 13 Nov 2016 10:50:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/using-columnno-inside-sum/m-p/1242381#M24682</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-11-13T10:50:54Z</dc:date>
    </item>
    <item>
      <title>Re: using columnno() inside sum()</title>
      <link>https://community.qlik.com/t5/App-Development/using-columnno-inside-sum/m-p/1242382#M24683</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I got a solution, which is doing the work:&lt;/P&gt;&lt;P&gt;Measure Calculation:&lt;/P&gt;&lt;P style="text-indent: 36.0pt;"&gt;if( $(vFinalCalc) &amp;gt; 0, $(vFinalCalc), 7 * (104 - ColumnNo()))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Loadscript:&lt;/P&gt;&lt;P style="text-indent: 36.0pt;"&gt;for i = 1 To 104;&lt;/P&gt;&lt;P style="text-indent: 36.0pt;"&gt;&amp;nbsp;&amp;nbsp; let i2 = i + 1;&lt;/P&gt;&lt;P style="text-indent: 36.0pt;"&gt;&amp;nbsp;&amp;nbsp; let l$(i) = 'sum(SOH) - rangesum(after(Sum(TD),1,$(i2))) &amp;lt;= 0'; &lt;/P&gt;&lt;P style="text-indent: 36.0pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; let r$(i) = 'round((sum(SOH) - rangesum(after(Sum(TD),1,$(i)))) / ((sum(SOH) - rangesum(after(Sum(TD),1,$(i))))-(sum(SOH) - rangesum(after(Sum(TD),1,$(i2)))))*7)';&lt;/P&gt;&lt;P style="text-indent: 36.0pt;"&gt;&amp;nbsp;&amp;nbsp; let vOneRowCalcLeft = vOneRowCalcLeft &amp;amp; ',' &amp;amp; chr(36) &amp;amp; '(l' &amp;amp; $(i) &amp;amp; ')';&lt;/P&gt;&lt;P style="text-indent: 36.0pt;"&gt;&amp;nbsp;&amp;nbsp; let vOneRowCalcRight = vOneRowCalcRight &amp;amp; ',' &amp;amp; chr(36) &amp;amp; '(r' &amp;amp; $(i) &amp;amp; ')';&lt;/P&gt;&lt;P style="text-indent: 36.0pt;"&gt;Next&lt;/P&gt;&lt;P style="text-indent: 36.0pt;"&gt;let vFinalCalc = 'match(-1 $(vOneRowCalcLeft)) * 7 + pick(match(-1 $(vOneRowCalcLeft)) $(vOneRowCalcRight))';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;THX for the help!!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Nov 2016 10:22:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/using-columnno-inside-sum/m-p/1242382#M24683</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-11-15T10:22:16Z</dc:date>
    </item>
  </channel>
</rss>

