<?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: How to create flag if ID and date is same as 'Purchase '  and Repurchase in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Re-How-to-create-flag-if-ID-and-date-is-same-as-Purchase-and/m-p/2068139#M1223532</link>
    <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/225725"&gt;@charu16aug&lt;/a&gt;&amp;nbsp; I am little bit lost here. So ID 1 has two purchase on Same day 27/03/2022, so shouldn't it be Purchase?&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 05 May 2023 11:49:20 GMT</pubDate>
    <dc:creator>Kushal_Chawda</dc:creator>
    <dc:date>2023-05-05T11:49:20Z</dc:date>
    <item>
      <title>Re: How to create flag if ID and date is same as 'Purchase '  and Repurchase</title>
      <link>https://community.qlik.com/t5/QlikView/Re-How-to-create-flag-if-ID-and-date-is-same-as-Purchase-and/m-p/2068124#M1223530</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/225725"&gt;@charu16aug&lt;/a&gt;&amp;nbsp; try below&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;Data:
Load * Inline
[
ID,Purchase_Date,Purchase,item
1,27/03/2022,500,charger
2,28/05/2022,700,mobile
2,28/05/2022,100,charger
1,27/03/2022,600,mobile
1,29/03/2022,300,laptop
3,30/01/2022,400,camera

];

Left Join(Data)
LOAD ID,
     Purchase_Date,
     count(ID) as ID_Cnt
Resident Data
Group by ID, Purchase_Date;

Final:
NoConcatenate 
Load *,
    if(ID_Cnt&amp;gt;1,'Purchase','Repurchase') as Flag
Resident Data; 

Drop Table Data;&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 05 May 2023 11:15:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Re-How-to-create-flag-if-ID-and-date-is-same-as-Purchase-and/m-p/2068124#M1223530</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2023-05-05T11:15:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to create flag if ID and date is same as 'Purchase '  and Repurchase</title>
      <link>https://community.qlik.com/t5/QlikView/Re-How-to-create-flag-if-ID-and-date-is-same-as-Purchase-and/m-p/2068130#M1223531</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks Kushal, but in case i have one more entry for&amp;nbsp;1,29/03/2022,300,mobile&amp;nbsp; then in this case&amp;nbsp; i should have Flag as repurchase for all ID as 1.So, what i want is if an ID purchase things on the same day doesn't matter how many times ,consider it as Purchase but if that ID is purchasing the other day then only consider it as repurchase&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;ID,Purchase_Date,Purchase,item
1,27/03/2022,500,charger
2,28/05/2022,700,mobile
2,28/05/2022,100,charger
1,27/03/2022,600,mobile
1,29/03/2022,300,laptop
3,30/01/2022,400,camera&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 May 2023 11:28:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Re-How-to-create-flag-if-ID-and-date-is-same-as-Purchase-and/m-p/2068130#M1223531</guid>
      <dc:creator>charu16aug</dc:creator>
      <dc:date>2023-05-05T11:28:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to create flag if ID and date is same as 'Purchase '  and Repurchase</title>
      <link>https://community.qlik.com/t5/QlikView/Re-How-to-create-flag-if-ID-and-date-is-same-as-Purchase-and/m-p/2068139#M1223532</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/225725"&gt;@charu16aug&lt;/a&gt;&amp;nbsp; I am little bit lost here. So ID 1 has two purchase on Same day 27/03/2022, so shouldn't it be Purchase?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 May 2023 11:49:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Re-How-to-create-flag-if-ID-and-date-is-same-as-Purchase-and/m-p/2068139#M1223532</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2023-05-05T11:49:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to create flag if ID and date is same as 'Purchase '  and Repurchase</title>
      <link>https://community.qlik.com/t5/QlikView/Re-How-to-create-flag-if-ID-and-date-is-same-as-Purchase-and/m-p/2068141#M1223533</link>
      <description>&lt;P&gt;wait let me explain with you an example&lt;/P&gt;
&lt;P&gt;ID,Purchase_Date,Purchase,item&lt;BR /&gt;1,27/03/2022,500,charger&lt;BR /&gt;2,28/05/2022,700,mobile&lt;BR /&gt;2,28/05/2022,100,charger&lt;BR /&gt;1,27/03/2022,600,mobile&lt;BR /&gt;1,29/03/2022,300,laptop&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;1,29/03/2022,300,mobile&lt;/STRONG&gt;&lt;BR /&gt;3,30/01/2022,400,camera&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;in the above data i have added one more entry , so now ID 1 for all the dates should be 'repurchase' because it has purchased item on two days &lt;STRONG&gt;27/03/2022&lt;/STRONG&gt; &amp;amp;&amp;nbsp;&lt;STRONG&gt;29/03/2022,300, but the ID&amp;nbsp;2 has purchased twice on same date i.e 28/05/2022,So it should be Purchase.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;hope it's clear now&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 05 May 2023 11:55:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Re-How-to-create-flag-if-ID-and-date-is-same-as-Purchase-and/m-p/2068141#M1223533</guid>
      <dc:creator>charu16aug</dc:creator>
      <dc:date>2023-05-05T11:55:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to create flag if ID and date is same as 'Purchase '  and Repurchase</title>
      <link>https://community.qlik.com/t5/QlikView/Re-How-to-create-flag-if-ID-and-date-is-same-as-Purchase-and/m-p/2068144#M1223534</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/225725"&gt;@charu16aug&lt;/a&gt;&amp;nbsp; try below&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;Data:
Load * Inline
[
ID,Purchase_Date,Purchase,item
1,27/03/2022,500,charger
2,28/05/2022,700,mobile
2,28/05/2022,100,charger
1,27/03/2022,600,mobile
1,29/03/2022,300,laptop
3,30/01/2022,400,camera

];

Left Join(Data)
LOAD ID,
     count(DISTINCT Purchase_Date) as Distinct_Date_cnt
Resident Data
Group by ID;

Final:
NoConcatenate 
Load *,
    if(Distinct_Date_cnt=1,'Purchase','Repurchase') as Flag
Resident Data; 

Drop Table Data;&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 05 May 2023 11:59:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Re-How-to-create-flag-if-ID-and-date-is-same-as-Purchase-and/m-p/2068144#M1223534</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2023-05-05T11:59:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to create flag if ID and date is same as 'Purchase '  and Repurchase</title>
      <link>https://community.qlik.com/t5/QlikView/Re-How-to-create-flag-if-ID-and-date-is-same-as-Purchase-and/m-p/2068164#M1223537</link>
      <description>&lt;P&gt;Thankyou so much Kushal&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 05 May 2023 12:19:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Re-How-to-create-flag-if-ID-and-date-is-same-as-Purchase-and/m-p/2068164#M1223537</guid>
      <dc:creator>charu16aug</dc:creator>
      <dc:date>2023-05-05T12:19:17Z</dc:date>
    </item>
  </channel>
</rss>

