<?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: hello i want to simplify this code in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/hello-i-want-to-simplify-this-code/m-p/2115903#M91054</link>
    <description>&lt;P&gt;You may outsource the set analysis condition in a variable, like here in varX:&lt;/P&gt;
&lt;P&gt;if(&lt;SPAN&gt;if(Var1=0, '{&amp;lt;Date = {"&amp;gt;=$(=YearStart(Today()))"}&amp;gt;}', ...)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;and then using:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;count($(varX)&amp;nbsp;Distinct DOCNO)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Such approach will improve the performance because the number of aggregation-calculations is reduced but in regard to the complexity it's no big change. Of course the expressions itself is simpler but the logic must be maintained in two places.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Alternative would be to create appropriate flags of YTD, MTD, ... within the calendar and using them within the set analysis.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 12 Sep 2023 10:19:01 GMT</pubDate>
    <dc:creator>marcus_sommer</dc:creator>
    <dc:date>2023-09-12T10:19:01Z</dc:date>
    <item>
      <title>hello i want to simplify this code</title>
      <link>https://community.qlik.com/t5/App-Development/hello-i-want-to-simplify-this-code/m-p/2115858#M91047</link>
      <description>&lt;P&gt;i have this code i want to know to can i simplify it and make it less complex for the speed of the sheets ?&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;(if(Var1=0,count({&amp;lt;Date = {"&amp;gt;=$(=YearStart(Today()))"}&amp;gt;}Distinct DOCNO), if(Var1=1,count({&amp;lt;DateNum={"&amp;gt;=$(=Num(MonthStart(Max(DateNum))))&amp;lt;=$(=Max(DateNum))"}&amp;gt;} Distinct DOCNO), if(Var1=2,count({&amp;lt;Date={"$(=DATE(TODAY()-1))"}&amp;gt;}Distinct DOCNO), if(Var1=3,count(Distinct DOCNO) )))) / if(Var1=0,Count({&amp;lt;[Date] = {"&amp;gt;=$(=Date(AddYears(YearStart(Today()),-1)))&amp;lt;$(=Date(AddYears(Today()-1,-1)))"}, Year=&amp;gt;}Distinct DOCNO), if(Var1=1,Count({&amp;lt;DateNum={"&amp;gt;=$(=Num(MonthStart(addyears(Max(DateNum),-1))))&amp;lt;=$(=num(addyears(Max(DateNum),-1)))"}, Year=&amp;gt;} Distinct DOCNO), if(Var1=2, count({&amp;lt;Date={"$(=DATE(addyears((TODAY()),-1)))"}, Year=&amp;gt;}Distinct DOCNO), if(Var1=3, count({&amp;lt;Year={"$(=Year(Addyears(Max(DateNum),-1)))"}&amp;gt;}Distinct DOCNO) )))) ) -1&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Nov 2024 21:24:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/hello-i-want-to-simplify-this-code/m-p/2115858#M91047</guid>
      <dc:creator>hafaneh</dc:creator>
      <dc:date>2024-11-15T21:24:58Z</dc:date>
    </item>
    <item>
      <title>Re: hello i want to simplify this code</title>
      <link>https://community.qlik.com/t5/App-Development/hello-i-want-to-simplify-this-code/m-p/2115903#M91054</link>
      <description>&lt;P&gt;You may outsource the set analysis condition in a variable, like here in varX:&lt;/P&gt;
&lt;P&gt;if(&lt;SPAN&gt;if(Var1=0, '{&amp;lt;Date = {"&amp;gt;=$(=YearStart(Today()))"}&amp;gt;}', ...)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;and then using:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;count($(varX)&amp;nbsp;Distinct DOCNO)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Such approach will improve the performance because the number of aggregation-calculations is reduced but in regard to the complexity it's no big change. Of course the expressions itself is simpler but the logic must be maintained in two places.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Alternative would be to create appropriate flags of YTD, MTD, ... within the calendar and using them within the set analysis.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Sep 2023 10:19:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/hello-i-want-to-simplify-this-code/m-p/2115903#M91054</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2023-09-12T10:19:01Z</dc:date>
    </item>
    <item>
      <title>Re: hello i want to simplify this code</title>
      <link>https://community.qlik.com/t5/App-Development/hello-i-want-to-simplify-this-code/m-p/2116725#M91119</link>
      <description>&lt;P&gt;If Var1 a single value at any given time? Or does Var1 vary row by row?&lt;/P&gt;
&lt;P&gt;-Rob&lt;/P&gt;</description>
      <pubDate>Wed, 13 Sep 2023 23:57:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/hello-i-want-to-simplify-this-code/m-p/2116725#M91119</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2023-09-13T23:57:06Z</dc:date>
    </item>
  </channel>
</rss>

