<?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 Sum when length of evaluated variable = 0 in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Sum-when-length-of-evaluated-variable-0/m-p/1653262#M48799</link>
    <description>&lt;P&gt;I'm trying the following formula to create a new variable for a KPI ,but it's not evaluating properly and I'm getting an invalid result:&lt;/P&gt;&lt;P&gt;sum(&lt;BR /&gt;{$&amp;lt;&lt;BR /&gt;Len($(vCrew))=0&lt;BR /&gt;&amp;gt;}&lt;BR /&gt;ShippedUnits&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;I can put Len($(vCrew)) in a chart measure and it works, but I just can't get it to evaluate as part of a set expression.&amp;nbsp; Please advise.&amp;nbsp; Thanks.&lt;/P&gt;</description>
    <pubDate>Sat, 16 Nov 2024 03:57:31 GMT</pubDate>
    <dc:creator>mikegrattan</dc:creator>
    <dc:date>2024-11-16T03:57:31Z</dc:date>
    <item>
      <title>Sum when length of evaluated variable = 0</title>
      <link>https://community.qlik.com/t5/App-Development/Sum-when-length-of-evaluated-variable-0/m-p/1653262#M48799</link>
      <description>&lt;P&gt;I'm trying the following formula to create a new variable for a KPI ,but it's not evaluating properly and I'm getting an invalid result:&lt;/P&gt;&lt;P&gt;sum(&lt;BR /&gt;{$&amp;lt;&lt;BR /&gt;Len($(vCrew))=0&lt;BR /&gt;&amp;gt;}&lt;BR /&gt;ShippedUnits&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;I can put Len($(vCrew)) in a chart measure and it works, but I just can't get it to evaluate as part of a set expression.&amp;nbsp; Please advise.&amp;nbsp; Thanks.&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 03:57:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Sum-when-length-of-evaluated-variable-0/m-p/1653262#M48799</guid>
      <dc:creator>mikegrattan</dc:creator>
      <dc:date>2024-11-16T03:57:31Z</dc:date>
    </item>
    <item>
      <title>Re: Sum when length of evaluated variable = 0</title>
      <link>https://community.qlik.com/t5/App-Development/Sum-when-length-of-evaluated-variable-0/m-p/1653332#M48810</link>
      <description>&lt;P&gt;Set analysis does not do a row by row evaluation.&lt;/P&gt;&lt;P&gt;Easiest way is to use the logic in load script and add a column for CrewShippedUnits&lt;/P&gt;&lt;P&gt;Could also use If&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Sum(&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If(L&lt;/SPAN&gt;&lt;SPAN&gt;en($(vCrew))=0,&lt;/SPAN&gt;&lt;SPAN&gt;ShippedUnits)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Dec 2019 21:16:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Sum-when-length-of-evaluated-variable-0/m-p/1653332#M48810</guid>
      <dc:creator>dwforest</dc:creator>
      <dc:date>2019-12-02T21:16:13Z</dc:date>
    </item>
    <item>
      <title>Re: Sum when length of evaluated variable = 0</title>
      <link>https://community.qlik.com/t5/App-Development/Sum-when-length-of-evaluated-variable-0/m-p/1653333#M48811</link>
      <description>&lt;P&gt;Your expression has two problems:&lt;/P&gt;&lt;P&gt;1. You can't use a function like that; you must use a field&lt;/P&gt;&lt;P&gt;2. You have to enclose the value 0 in {}&lt;/P&gt;&lt;P&gt;To do what you want, the simplest method is to calculate the Length during the load and then use that as your field:&lt;/P&gt;&lt;P&gt;sum({&amp;lt;FieldLength={0}&amp;gt;} ShippedUnits)&lt;/P&gt;&lt;P&gt;To do it using vCrew, you need to have a field that is a unique identifier in the table that vCrew is in, and then write the expression like:&lt;/P&gt;&lt;P&gt;sum({&amp;lt;UniqueID={"=Len([$(vCrew)])=0"}&amp;gt;} ShippedUnits)&lt;/P&gt;&lt;P&gt;I put $(vCrew) inside square brackets, assuming that vCrew evaluates to a field name without quotes or brackets.&lt;/P&gt;&lt;P&gt;Warning: You may need to enclose Len([$(vCrew)]) inside another $(). I don't have access to Qlik at the moment...&lt;/P&gt;</description>
      <pubDate>Mon, 02 Dec 2019 21:16:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Sum-when-length-of-evaluated-variable-0/m-p/1653333#M48811</guid>
      <dc:creator>Lauri</dc:creator>
      <dc:date>2019-12-02T21:16:56Z</dc:date>
    </item>
    <item>
      <title>Re: Sum when length of evaluated variable = 0</title>
      <link>https://community.qlik.com/t5/App-Development/Sum-when-length-of-evaluated-variable-0/m-p/1653334#M48812</link>
      <description>&lt;P&gt;Thank you, the If statement was all I needed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Dec 2019 21:20:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Sum-when-length-of-evaluated-variable-0/m-p/1653334#M48812</guid>
      <dc:creator>mikegrattan</dc:creator>
      <dc:date>2019-12-02T21:20:00Z</dc:date>
    </item>
  </channel>
</rss>

