<?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: Expression with modifier and if function in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Expression-with-modifier-and-if-function/m-p/2416445#M95169</link>
    <description>&lt;P&gt;I wouldn't use an if-loop for it else including it within the set analysis like suggested from&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/28943"&gt;@Nagaraju_KCS&lt;/a&gt;&amp;nbsp;+ defining there the default-value, for example with:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;...&amp;nbsp;ProductID= {"&amp;gt;=&lt;STRONG&gt;alt(&lt;/STRONG&gt;$(vMinProductID)&lt;STRONG&gt;,&lt;/STRONG&gt; &lt;STRONG&gt;Default1)&lt;/STRONG&gt;&amp;lt;= &lt;STRONG&gt;alt(&lt;/STRONG&gt;$(vMaxProductID)&lt;STRONG&gt;, Default2)&lt;/STRONG&gt;"} ...&lt;/P&gt;
&lt;P&gt;Instead of alt() you may also use rangemin() and rangemax() to define the thresholds. Further by aware that a variable-call to a variable without any content respectively being EMPTY or NULL may fail by applying a $-sign expansion - in this case just skip it.&lt;/P&gt;
&lt;P&gt;Beside of this it's often far more expedient not to implement such logic else to let the user select the wanted values in the field, just by applying a search like: &amp;gt;=MinValue&amp;lt;=MaxValue. Setting instead variable-values isn't easier or less work - it's just a detour with more complexity and less&amp;nbsp;comprehension.&lt;/P&gt;</description>
    <pubDate>Thu, 08 Feb 2024 08:31:03 GMT</pubDate>
    <dc:creator>marcus_sommer</dc:creator>
    <dc:date>2024-02-08T08:31:03Z</dc:date>
    <item>
      <title>Expression with modifier and if function</title>
      <link>https://community.qlik.com/t5/App-Development/Expression-with-modifier-and-if-function/m-p/2416296#M95161</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I'm trying to create a measure to get a count of all unique sales.&lt;/P&gt;
&lt;P&gt;My table has columns like: OrderDate, SaleID,DeliveryDate, ProductID, Product Description, Status,Delivery Type,Country, State, City, Quantity, Price.&lt;/P&gt;
&lt;P&gt;I have an existing master item to count unique sales with certain modifiers as below:&lt;/P&gt;
&lt;P&gt;count(distinct{&amp;lt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Country-={'Abcde'}&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;,DeliveryType={$(vExcludeCODDelivery)}&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;,Status={$(vExcludeReturnStatus)}&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;gt;}SaleID)&lt;/P&gt;
&lt;P&gt;I need to modify this calculation to only consider SaleID with following criteria:&lt;/P&gt;
&lt;P&gt;ProductID &amp;gt;= vMinProductID and&amp;nbsp;ProductID &amp;lt;= vMaxProductID , where I am getting the variables filled in input box by User. Also, when no entries would be available in input box the min and max values should default to 0 and 100, respectively.&lt;/P&gt;
&lt;P&gt;This is how I have defined the calculation to achieve new condition in a table called Details:&lt;/P&gt;
&lt;DIV&gt;=aggr(&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt; if(&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ProductID&amp;gt;= (if(Len(Trim('$(vMinProductID )')) = 0,0,$(vMinProductID )))&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; and&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ProductID&amp;lt;= (if(Len(Trim('$(vMaxProductID )')) = 0,6650,$(vMaxProductID )))&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ,&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;ProductID)&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;,ProductID)&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;I am unsure how to create a new expression taking all conditions into consideration.&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;I would appreciate all advises.&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;Thank you.&lt;/DIV&gt;</description>
      <pubDate>Wed, 07 Feb 2024 23:04:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Expression-with-modifier-and-if-function/m-p/2416296#M95161</guid>
      <dc:creator>Neha7</dc:creator>
      <dc:date>2024-02-07T23:04:18Z</dc:date>
    </item>
    <item>
      <title>Re: Expression with modifier and if function</title>
      <link>https://community.qlik.com/t5/App-Development/Expression-with-modifier-and-if-function/m-p/2416386#M95164</link>
      <description>&lt;P&gt;may be this&lt;/P&gt;
&lt;P&gt;count(distinct{&amp;lt;Country-={'Abcde'},&amp;nbsp;&lt;STRONG&gt;ProductID= {"&amp;gt;=$(vMinProductID)&amp;nbsp;&amp;lt;= $(vMaxProductID)"},&lt;/STRONG&gt;&lt;BR /&gt;,DeliveryType={$(vExcludeCODDelivery)},Status={$(vExcludeReturnStatus)}&amp;gt;}SaleID)&lt;/P&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Thu, 08 Feb 2024 06:03:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Expression-with-modifier-and-if-function/m-p/2416386#M95164</guid>
      <dc:creator>Nagaraju_KCS</dc:creator>
      <dc:date>2024-02-08T06:03:13Z</dc:date>
    </item>
    <item>
      <title>Re: Expression with modifier and if function</title>
      <link>https://community.qlik.com/t5/App-Development/Expression-with-modifier-and-if-function/m-p/2416445#M95169</link>
      <description>&lt;P&gt;I wouldn't use an if-loop for it else including it within the set analysis like suggested from&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/28943"&gt;@Nagaraju_KCS&lt;/a&gt;&amp;nbsp;+ defining there the default-value, for example with:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;...&amp;nbsp;ProductID= {"&amp;gt;=&lt;STRONG&gt;alt(&lt;/STRONG&gt;$(vMinProductID)&lt;STRONG&gt;,&lt;/STRONG&gt; &lt;STRONG&gt;Default1)&lt;/STRONG&gt;&amp;lt;= &lt;STRONG&gt;alt(&lt;/STRONG&gt;$(vMaxProductID)&lt;STRONG&gt;, Default2)&lt;/STRONG&gt;"} ...&lt;/P&gt;
&lt;P&gt;Instead of alt() you may also use rangemin() and rangemax() to define the thresholds. Further by aware that a variable-call to a variable without any content respectively being EMPTY or NULL may fail by applying a $-sign expansion - in this case just skip it.&lt;/P&gt;
&lt;P&gt;Beside of this it's often far more expedient not to implement such logic else to let the user select the wanted values in the field, just by applying a search like: &amp;gt;=MinValue&amp;lt;=MaxValue. Setting instead variable-values isn't easier or less work - it's just a detour with more complexity and less&amp;nbsp;comprehension.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2024 08:31:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Expression-with-modifier-and-if-function/m-p/2416445#M95169</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2024-02-08T08:31:03Z</dc:date>
    </item>
  </channel>
</rss>

