<?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: if statement in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/if-statement/m-p/2034200#M85218</link>
    <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;Just use set analysis&lt;/P&gt;
&lt;P&gt;Count(DISTINCT{$&amp;lt;[Initial Status]={'Approved'}&amp;gt;} OrderID)&lt;/P&gt;</description>
    <pubDate>Sun, 05 Feb 2023 12:07:04 GMT</pubDate>
    <dc:creator>BrunPierre</dc:creator>
    <dc:date>2023-02-05T12:07:04Z</dc:date>
    <item>
      <title>if statement</title>
      <link>https://community.qlik.com/t5/App-Development/if-statement/m-p/2034194#M85216</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I have default data that looks like below, where for each order id i can have multiple values in field (Initial Status):&lt;/P&gt;
&lt;TABLE width="548"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="136.788px" height="24px"&gt;OrderID&lt;/TD&gt;
&lt;TD width="136.812px" height="24px"&gt;&lt;FONT color="#FF0000"&gt;Initial Status&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="136.812px" height="24px"&gt;&lt;FONT color="#339966"&gt;New Status&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="136.788px" height="24px"&gt;&lt;FONT color="#339966"&gt;Orders&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD rowspan="4" width="136.788px" height="96px"&gt;Order 1&lt;/TD&gt;
&lt;TD width="136.812px" height="24px"&gt;Approved&lt;/TD&gt;
&lt;TD width="136.812px" height="24px"&gt;&lt;FONT color="#339966"&gt;Approved&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="136.788px" height="24px"&gt;&lt;FONT color="#339966"&gt;1&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="136.812px" height="24px"&gt;Canceled&lt;/TD&gt;
&lt;TD width="136.812px" height="24px"&gt;&lt;FONT color="#993300"&gt;Approved&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="136.788px" height="24px"&gt;&lt;FONT color="#993300"&gt;0&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="136.812px" height="24px"&gt;Declined&lt;/TD&gt;
&lt;TD width="136.812px" height="24px"&gt;&lt;FONT color="#993300"&gt;Approved&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="136.788px" height="24px"&gt;&lt;FONT color="#993300"&gt;0&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="136.812px" height="24px"&gt;WIP&lt;/TD&gt;
&lt;TD width="136.812px" height="24px"&gt;&lt;FONT color="#993300"&gt;Approved&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="136.788px" height="24px"&gt;&lt;FONT color="#993300"&gt;0&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD rowspan="3" width="136.788px" height="72px"&gt;Order 2&lt;/TD&gt;
&lt;TD width="136.812px" height="24px"&gt;WIP&lt;/TD&gt;
&lt;TD width="136.812px" height="24px"&gt;&lt;FONT color="#339966"&gt;WIP&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="136.788px" height="24px"&gt;&lt;FONT color="#339966"&gt;1&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="136.812px" height="24px"&gt;Canceled&lt;/TD&gt;
&lt;TD width="136.812px" height="24px"&gt;&lt;FONT color="#993300"&gt;WIP&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="136.788px" height="24px"&gt;&lt;FONT color="#993300"&gt;0&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="136.812px" height="24px"&gt;Declined&lt;/TD&gt;
&lt;TD width="136.812px" height="24px"&gt;&lt;FONT color="#993300"&gt;WIP&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="136.788px" height="24px"&gt;&lt;FONT color="#993300"&gt;0&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD rowspan="2" width="136.788px" height="48px"&gt;Order 3&lt;/TD&gt;
&lt;TD width="136.812px" height="24px"&gt;Declined&lt;/TD&gt;
&lt;TD width="136.812px" height="24px"&gt;&lt;FONT color="#339966"&gt;Declined&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="136.788px" height="24px"&gt;&lt;FONT color="#339966"&gt;1&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="136.812px" height="24px"&gt;Canceled&lt;/TD&gt;
&lt;TD width="136.812px" height="24px"&gt;&lt;FONT color="#993300"&gt;Declined&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="136.788px" height="24px"&gt;&lt;FONT color="#993300"&gt;0&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="136.788px" height="24px"&gt;Order 4&lt;/TD&gt;
&lt;TD width="136.812px" height="24px"&gt;Canceled&lt;/TD&gt;
&lt;TD width="136.812px" height="24px"&gt;&lt;FONT color="#339966"&gt;Canceled&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD width="136.788px" height="24px"&gt;&lt;FONT color="#339966"&gt;1&lt;/FONT&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to count unique orders depending on values inside status field : if status = approved, count it only once, no matter what other status this order has or return a new status as 'approved';&amp;nbsp; The 4 orders from above are 4 situations possible.&lt;/P&gt;
&lt;P&gt;Thank you in advance for your help!&lt;/P&gt;</description>
      <pubDate>Sun, 05 Feb 2023 09:53:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/if-statement/m-p/2034194#M85216</guid>
      <dc:creator>winniethepooh</dc:creator>
      <dc:date>2023-02-05T09:53:05Z</dc:date>
    </item>
    <item>
      <title>Re: if statement</title>
      <link>https://community.qlik.com/t5/App-Development/if-statement/m-p/2034197#M85217</link>
      <description>&lt;P&gt;HI&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/200655"&gt;@winniethepooh&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;try this -&amp;nbsp;&lt;BR /&gt;count({&amp;lt;[&lt;SPAN&gt;Initial Status&lt;/SPAN&gt;]={'&lt;SPAN&gt;Approved&lt;/SPAN&gt;'}&amp;gt;}distinct &lt;SPAN&gt;OrderID&lt;/SPAN&gt;)&lt;/P&gt;
&lt;P&gt;regards&lt;/P&gt;</description>
      <pubDate>Sun, 05 Feb 2023 11:54:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/if-statement/m-p/2034197#M85217</guid>
      <dc:creator>MendyS</dc:creator>
      <dc:date>2023-02-05T11:54:05Z</dc:date>
    </item>
    <item>
      <title>Re: if statement</title>
      <link>https://community.qlik.com/t5/App-Development/if-statement/m-p/2034200#M85218</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;Just use set analysis&lt;/P&gt;
&lt;P&gt;Count(DISTINCT{$&amp;lt;[Initial Status]={'Approved'}&amp;gt;} OrderID)&lt;/P&gt;</description>
      <pubDate>Sun, 05 Feb 2023 12:07:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/if-statement/m-p/2034200#M85218</guid>
      <dc:creator>BrunPierre</dc:creator>
      <dc:date>2023-02-05T12:07:04Z</dc:date>
    </item>
    <item>
      <title>Re: if statement</title>
      <link>https://community.qlik.com/t5/App-Development/if-statement/m-p/2034205#M85220</link>
      <description>&lt;P&gt;Tried that already. But because my DB means default multiple status for the same order, i need to 'choose' one (prioritize status).&lt;/P&gt;
&lt;P&gt;Expression from above gives me this result. And i want this to bring me '1' only on Approved, and 0 to any others.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="winniethepooh_0-1675599922465.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/99728i5ED0D76E5E605830/image-size/medium?v=v2&amp;amp;px=400" role="button" title="winniethepooh_0-1675599922465.png" alt="winniethepooh_0-1675599922465.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Another case is when i don't have 'approved status' in my DB,just like below=&amp;gt; in this case i want 0 for Approve, 1 for WIP, and 0 for all other:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="winniethepooh_1-1675600037896.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/99729i196AE134B3B3B62C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="winniethepooh_1-1675600037896.png" alt="winniethepooh_1-1675600037896.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 05 Feb 2023 12:29:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/if-statement/m-p/2034205#M85220</guid>
      <dc:creator>winniethepooh</dc:creator>
      <dc:date>2023-02-05T12:29:32Z</dc:date>
    </item>
    <item>
      <title>Re: if statement</title>
      <link>https://community.qlik.com/t5/App-Development/if-statement/m-p/2034207#M85222</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/200655"&gt;@winniethepooh&lt;/a&gt;&amp;nbsp; there are couple of ways to get this done.&lt;/P&gt;
&lt;P&gt;Either use set analysis like below:&lt;/P&gt;
&lt;P&gt;Count(distinct {&amp;lt;[Initial Status]={'Approved'}&amp;gt;}OrderID)&lt;/P&gt;
&lt;P&gt;Or use the normal if statement in the expression:&lt;/P&gt;
&lt;P&gt;Count(if([Initial Status]='Approved', OrderID))&lt;/P&gt;</description>
      <pubDate>Sun, 05 Feb 2023 12:35:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/if-statement/m-p/2034207#M85222</guid>
      <dc:creator>sidhiq91</dc:creator>
      <dc:date>2023-02-05T12:35:35Z</dc:date>
    </item>
    <item>
      <title>Re: if statement</title>
      <link>https://community.qlik.com/t5/App-Development/if-statement/m-p/2034210#M85224</link>
      <description>&lt;P&gt;Unfortunately, this doesn't work as i have my order with 4 different statuses at the same time and i need to bring in the report only one, depending on their logic for business&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":pensive_face:"&gt;😔&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="winniethepooh_0-1675600811959.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/99730i468E1150CAF5464D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="winniethepooh_0-1675600811959.png" alt="winniethepooh_0-1675600811959.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 05 Feb 2023 12:46:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/if-statement/m-p/2034210#M85224</guid>
      <dc:creator>winniethepooh</dc:creator>
      <dc:date>2023-02-05T12:46:59Z</dc:date>
    </item>
    <item>
      <title>Re: if statement</title>
      <link>https://community.qlik.com/t5/App-Development/if-statement/m-p/2034213#M85226</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="winniethepooh_0-1675601646657.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/99731iFC3F24D3D0E83BBE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="winniethepooh_0-1675601646657.png" alt="winniethepooh_0-1675601646657.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;maybe this explains better&lt;/P&gt;</description>
      <pubDate>Sun, 05 Feb 2023 12:55:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/if-statement/m-p/2034213#M85226</guid>
      <dc:creator>winniethepooh</dc:creator>
      <dc:date>2023-02-05T12:55:01Z</dc:date>
    </item>
    <item>
      <title>Re: if statement</title>
      <link>https://community.qlik.com/t5/App-Development/if-statement/m-p/2034227#M85229</link>
      <description>&lt;P&gt;One solution through Script:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;tab1:
LOAD RowNo() As ID,*; 
LOAD * INLINE [
    OrderID, Initial Status
    Order 1, Approved
    Order 1, Canceled
    Order 1, Declined
    Order 1, WIP
    Order 2, WIP
    Order 2, Canceled
    Order 2, Declined
    Order 3, Declined
    Order 3, Canceled
    Order 4, Canceled
];

Left Join(tab1)
LOAD OrderID, If(Index(Concat(DISTINCT [Initial Status]),'Approved')&amp;gt;0, 'Approved', FirstSortedValue([Initial Status],ID)) As New_Status
Resident tab1
Group By OrderID;

Left Join(tab1)
LOAD OrderID, [Initial Status],New_Status, If([Initial Status]=New_Status,1,0) As Orders
Resident tab1;&lt;/LI-CODE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="commQV02.png" style="width: 373px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/99733i1C42054F56AF74FC/image-size/large?v=v2&amp;amp;px=999" role="button" title="commQV02.png" alt="commQV02.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 05 Feb 2023 18:10:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/if-statement/m-p/2034227#M85229</guid>
      <dc:creator>Saravanan_Desingh</dc:creator>
      <dc:date>2023-02-05T18:10:51Z</dc:date>
    </item>
    <item>
      <title>Re: if statement</title>
      <link>https://community.qlik.com/t5/App-Development/if-statement/m-p/2034232#M85230</link>
      <description>&lt;P&gt;It worked!&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":smiling_face_with_heart_eyes:"&gt;😍&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Thank you for helping!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 05 Feb 2023 20:04:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/if-statement/m-p/2034232#M85230</guid>
      <dc:creator>winniethepooh</dc:creator>
      <dc:date>2023-02-05T20:04:55Z</dc:date>
    </item>
  </channel>
</rss>

