<?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: Sum If FieldName contains (LOAD script) in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Sum-If-FieldName-contains-LOAD-script/m-p/1009049#M342534</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hmm!!! That's a curve ball. Would you be able to share some sample data and your expected output?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 27 Aug 2015 13:16:33 GMT</pubDate>
    <dc:creator>sunny_talwar</dc:creator>
    <dc:date>2015-08-27T13:16:33Z</dc:date>
    <item>
      <title>Sum If FieldName contains (LOAD script)</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-If-FieldName-contains-LOAD-script/m-p/1009046#M342531</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;Sorry for not being able to show any of my workings, but I'm really stuck on where to begin here.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to write a load script similar to this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Test(Conversion1),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Test(Conversion2),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If(Field Name) Contains "Test" then Sum(FieldName) as Sales&lt;/P&gt;&lt;P&gt;FROM&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BLah&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does this make sense? I want to pick out fields that contain "Test" and sum their contents.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;James.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Aug 2015 13:07:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-If-FieldName-contains-LOAD-script/m-p/1009046#M342531</guid>
      <dc:creator>wallerjc</dc:creator>
      <dc:date>2015-08-27T13:07:12Z</dc:date>
    </item>
    <item>
      <title>Re: Sum If FieldName contains (LOAD script)</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-If-FieldName-contains-LOAD-script/m-p/1009047#M342532</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;May be this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG&gt;LOAD&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Test(Conversion1),&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Test(Conversion2),&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If(WildMatch(Field Name, '*Test*', Sum(FieldName)) as SumFieldName&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;STRONG&gt;FROM &lt;SPAN style="line-height: 1.5em;"&gt;BLah&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;SPAN style="line-height: 1.5em;"&gt;&lt;STRONG&gt;Group By &lt;/STRONG&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;STRONG&gt;Test(Conversion1), &lt;/STRONG&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;STRONG&gt;Test(Conversion2)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Aug 2015 13:10:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-If-FieldName-contains-LOAD-script/m-p/1009047#M342532</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2015-08-27T13:10:11Z</dc:date>
    </item>
    <item>
      <title>Re: Sum If FieldName contains (LOAD script)</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-If-FieldName-contains-LOAD-script/m-p/1009048#M342533</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This would work in theory I guess but "FieldName" needs to be a variable, I don't actually have a FieldName called FieldName. It would need to look through all fields in the table&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Aug 2015 13:14:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-If-FieldName-contains-LOAD-script/m-p/1009048#M342533</guid>
      <dc:creator>wallerjc</dc:creator>
      <dc:date>2015-08-27T13:14:33Z</dc:date>
    </item>
    <item>
      <title>Re: Sum If FieldName contains (LOAD script)</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-If-FieldName-contains-LOAD-script/m-p/1009049#M342534</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hmm!!! That's a curve ball. Would you be able to share some sample data and your expected output?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Aug 2015 13:16:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-If-FieldName-contains-LOAD-script/m-p/1009049#M342534</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2015-08-27T13:16:33Z</dc:date>
    </item>
    <item>
      <title>Re: Sum If FieldName contains (LOAD script)</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-If-FieldName-contains-LOAD-script/m-p/1009050#M342535</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A LOAD reads records one-by-one, so Summing fields doesn't make sense unless you group records according to predefined rules (for example by customer, product, year or whatever you think is necessary)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In a LOAD specification, column names must be explicitly specified (litterally) or listed as a whole by way of an *. You want to make the expression dependent on the field at hand, but you don't specify any fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Moreover, an imaginary construct like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;IF (MyFirstFieldTest has "Test" in its name, Do something) AS SumOfMyFirstFieldTest,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;is an overly complex way of saying just&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;Do something with MyFirstFieldTest AS SumOfMyFieldTest,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;because you can already see that there is "Test" in its name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What you're after can be done however using a field list, some procedural code (i.e. a LOOP) and $-sign substitution. But in that case almost everything is happening outside of the LOAD statement itself. A LOAD statement can specify conditionally executed code, but cannot have a conditional syntax.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Peter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Aug 2015 13:20:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-If-FieldName-contains-LOAD-script/m-p/1009050#M342535</guid>
      <dc:creator>Peter_Cammaert</dc:creator>
      <dc:date>2015-08-27T13:20:33Z</dc:date>
    </item>
    <item>
      <title>Re: Sum If FieldName contains (LOAD script)</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-If-FieldName-contains-LOAD-script/m-p/1009051#M342536</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Mate&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;check out the attachment here, You can see I would like to sum all the columns which say "Sales" in their field&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BUT here's the real kicker, if I added another field called Sales(Ten) I would like that to also be summed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is this possible to your knowledge? It's certainly too difficult for me.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Aug 2015 13:24:41 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-If-FieldName-contains-LOAD-script/m-p/1009051#M342536</guid>
      <dc:creator>wallerjc</dc:creator>
      <dc:date>2015-08-27T13:24:41Z</dc:date>
    </item>
    <item>
      <title>Re: Sum If FieldName contains (LOAD script)</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-If-FieldName-contains-LOAD-script/m-p/1009052#M342537</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you can not have aggregation without group by clause.. I think you need to re look at on how to achieve your requirement.. Could you may be provide a sample?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Aug 2015 13:36:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-If-FieldName-contains-LOAD-script/m-p/1009052#M342537</guid>
      <dc:creator>sasiparupudi1</dc:creator>
      <dc:date>2015-08-27T13:36:14Z</dc:date>
    </item>
    <item>
      <title>Re: Sum If FieldName contains (LOAD script)</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-If-FieldName-contains-LOAD-script/m-p/1009053#M342538</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It sounds to me like you have a poor model structure and which requires you to force fit a complex solution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is almost always better to transform your data model into a form that simplifies further processing and the subsequent expressions in the front end. I think you should explore making use of a CrossTable load to convert these field names into values that can be used by conventional expressions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also look at these sources:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/docs/DOC-8844"&gt;Get started with developing qlik datamodels&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/docs/DOC-9038"&gt;Advanced topics for creating a qlik datamodel&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Aug 2015 13:48:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-If-FieldName-contains-LOAD-script/m-p/1009053#M342538</guid>
      <dc:creator>jonathandienst</dc:creator>
      <dc:date>2015-08-27T13:48:25Z</dc:date>
    </item>
    <item>
      <title>Re: Sum If FieldName contains (LOAD script)</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-If-FieldName-contains-LOAD-script/m-p/1009054#M342539</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can do it in two passes like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;Data:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;LOAD *&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;FROM&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;Book1.xlsx&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;(ooxml, embedded labels, table is Sheet1);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;SET vLoad=;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;FOR i = 1 to NoOfFields('Data')&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; LET vFname = FieldName($(i),Data);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; IF '$(vFname)' LIKE 'sales*' THEN&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; LET vLoad = '$(vLoad)'&amp;nbsp; &amp;amp; chr(10) &amp;amp; ',sum([$(vFname)]) as [Summed_$(vFname)]';&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; ENDIF&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;NEXT i&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;Summed:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;LOAD&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; Name&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; $(vLoad)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;RESIDENT Data&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;GROUP BY Name;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Rob&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small" href="http://masterssummit.com" rel="nofollow"&gt;http://masterssummit.com&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small" href="http://qlikviewcookbook.com" rel="nofollow"&gt;http://qlikviewcookbook.com&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Aug 2015 17:59:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-If-FieldName-contains-LOAD-script/m-p/1009054#M342539</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2015-08-27T17:59:58Z</dc:date>
    </item>
    <item>
      <title>Re: Sum If FieldName contains (LOAD script)</title>
      <link>https://community.qlik.com/t5/QlikView/Sum-If-FieldName-contains-LOAD-script/m-p/1766673#M454304</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;do you know how it would be if we had two fields instead of one field? Some like this:&lt;/P&gt;&lt;P&gt;if(WildMatch([EAN],'xxxxxx') or WildMatch([EAN],'yyyyyy'),sum(stockLineal), stockLineal) AS Control_stock_stockLineal,&lt;/P&gt;&lt;P&gt;I need to sum the stockLineal field when the EAN field is 'xxxxx' or 'yyyyy'.&lt;/P&gt;&lt;P&gt;Thank you in advance!&lt;/P&gt;</description>
      <pubDate>Mon, 07 Dec 2020 12:58:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Sum-If-FieldName-contains-LOAD-script/m-p/1766673#M454304</guid>
      <dc:creator>PuriVelasco</dc:creator>
      <dc:date>2020-12-07T12:58:49Z</dc:date>
    </item>
  </channel>
</rss>

