<?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: Calculation based on customer id in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Calculation-based-on-customer-id/m-p/2349652#M116609</link>
    <description>&lt;P&gt;This doesn't really help. I cannot see the complete expressions and I cannot see what is wrong with the data. I *might* be able to figure something out if I could see the source data and how it is returned, but at the moment I do not even understand what the problem is.&lt;/P&gt;</description>
    <pubDate>Fri, 08 Dec 2017 09:16:43 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2017-12-08T09:16:43Z</dc:date>
    <item>
      <title>Calculation based on customer id</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Calculation-based-on-customer-id/m-p/2349642#M116599</link>
      <description>How to get the actual value from the cummulative value in talend ? for example On a paricular a car runs for 1000 kms next day the car will start from 1001 kms ,So what i need is how to calculate the total kms covered on a particular day 
&lt;BR /&gt;1000kms on 27-10-2017 2000kms on 28-10-2017 
&lt;BR /&gt;so the total kms covered on 28-10-2017 is 1000kms how to do that in talend for which i need to update around 1 lakh history records using the above method and this needs to be done in mongodb 
&lt;BR /&gt;And there are two customers with customer id 1&amp;amp;2 
&lt;BR /&gt;For 2017-11-27 
&lt;BR /&gt;1 has 1000 
&lt;BR /&gt;2 has 2000 
&lt;BR /&gt;For 2017-11-28 
&lt;BR /&gt;1 has 2000 
&lt;BR /&gt;2 has 3000 
&lt;BR /&gt;How to subtract cummlative values based on the customer id so that on 
&lt;BR /&gt;2017-11-28 I will get 
&lt;BR /&gt;1 has 1000 
&lt;BR /&gt;2 has 1000 
&lt;BR /&gt;Thanks</description>
      <pubDate>Wed, 29 Nov 2017 02:11:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Calculation-based-on-customer-id/m-p/2349642#M116599</guid>
      <dc:creator>krengan21</dc:creator>
      <dc:date>2017-11-29T02:11:57Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation based on customer id</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Calculation-based-on-customer-id/m-p/2349643#M116600</link>
      <description>Select the data for both days separately. Join the result sets on customer id so you have values for both days on the same row, using a tMap. Create the desired output schema in the tMap, calculating the difference between the two values as the output.</description>
      <pubDate>Thu, 30 Nov 2017 16:30:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Calculation-based-on-customer-id/m-p/2349643#M116600</guid>
      <dc:creator>cterenzi</dc:creator>
      <dc:date>2017-11-30T16:30:55Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation based on customer id</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Calculation-based-on-customer-id/m-p/2349644#M116601</link>
      <description>&lt;P&gt;OK, assuming that your data looks similar to this.....&lt;/P&gt; 
&lt;PRE&gt;.---+-----+----------.
|     tLogRow_2      |
|=--+-----+---------=|
|day|miles|customerId|
|=--+-----+---------=|
|1  |100.0|1         |
|1  |80.0 |2         |
|2  |150.0|1         |
|3  |175.0|1         |
|2  |201.0|2         |
|3  |212.0|2         |
|4  |230.0|1         |
|5  |301.0|1         |
|4  |321.0|2         |
'---+-----+----------'&lt;/PRE&gt; 
&lt;P&gt;....you can solve this in the following way. Here is a screenshot of a job I have knocked up quickly.....&lt;/P&gt; 
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="job_layout.png" style="width: 749px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009LrtE.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/152987i82590F98FDCEFD91/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009LrtE.png" alt="0683p000009LrtE.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;I use a tFiexedFlowInput to hard code some values. This will be your data source. I use a tSortRow to sort by CustomerID and then Day. I do most of the work in the tMap. Below you can see the tFixedFlow and tSortRow configs....&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="fixed_flow.png" style="width: 999px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009LrRQ.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/151057iE6238751FC3540B4/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009LrRQ.png" alt="0683p000009LrRQ.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Sort.png" style="width: 999px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009Lrg8.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/131556i9E4E06A4C23EF5E2/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009Lrg8.png" alt="0683p000009Lrg8.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Now, the tMap is where the work is carried. I use a very similar mechanism to the one I showed you last time. It revolves around the ability of the tMap variables to hold the previous row's values. A screenshot can be seen below....&lt;/P&gt; 
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tmap_example.png" style="width: 999px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="0683p000009LrqQ.png"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/136302iDFA1BBD1059086B1/image-size/large?v=v2&amp;amp;px=999" role="button" title="0683p000009LrqQ.png" alt="0683p000009LrqQ.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Like the other example, the tMap variables must configured EXACTLY as they are here.&lt;/P&gt; 
&lt;P&gt;&lt;STRONG&gt;customerChanged&lt;/STRONG&gt;&lt;/P&gt; 
&lt;P&gt;Used to identify if the customer ID has changed. This works because the sort order is ordered by CustomerID first.&lt;/P&gt; 
&lt;PRE&gt;Var.lastCustomerID==null || Var.lastCustomerID!=row2.customerId&lt;/PRE&gt; 
&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;lastCustomerID&lt;/STRONG&gt;&lt;BR /&gt;Used to remember the last customer ID&lt;/P&gt; 
&lt;PRE&gt;row2.customerId&lt;/PRE&gt; 
&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;todaysDistance&lt;/STRONG&gt;&lt;BR /&gt;Used to calculate todays distance. Very similar to last example, but factors in the change in Customer ID&lt;/P&gt; 
&lt;PRE&gt;Var.customerChanged ? row2.miles : row2.miles - Var.lastDistance&lt;/PRE&gt; 
&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;lastDistance&lt;/STRONG&gt;&lt;BR /&gt;The same as the previous example. Used to remeber the previous distance&lt;/P&gt; 
&lt;PRE&gt;row2.miles&lt;/PRE&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Now, this can be a bit tricky to figure out, but it does work. The output from this (assuming the data above) was this.....&lt;/P&gt; 
&lt;PRE&gt;.----------+---+--------------.
|          tLogRow_1          |
|=---------+---+-------------=|
|customerId|day|todaysDistance|
|=---------+---+-------------=|
|1         |1  |100.0         |
|1         |2  |50.0          |
|1         |3  |25.0          |
|1         |4  |55.0          |
|1         |5  |71.0          |
|2         |1  |80.0          |
|2         |2  |121.0         |
|2         |3  |11.0          |
|2         |4  |109.0         |
'----------+---+--------------'&lt;/PRE&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Nov 2017 17:26:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Calculation-based-on-customer-id/m-p/2349644#M116601</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-11-30T17:26:06Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation based on customer id</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Calculation-based-on-customer-id/m-p/2349645#M116602</link>
      <description>&lt;P&gt;HI ,&lt;/P&gt;&lt;P&gt;Thanks for the solution but it is failing in certain conditions sometimes the condition is failing ,Like same cummulative value is reflected in the today distance travelled .What should be done for that case&lt;/P&gt;</description>
      <pubDate>Fri, 01 Dec 2017 13:35:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Calculation-based-on-customer-id/m-p/2349645#M116602</guid>
      <dc:creator>krengan21</dc:creator>
      <dc:date>2017-12-01T13:35:59Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation based on customer id</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Calculation-based-on-customer-id/m-p/2349646#M116603</link>
      <description>&lt;P&gt;You will need to send me a data scenario where it fails. This process should cover the scenarios where you get results daily for every customerID, if you have followed it closely. If you have days missing then you might experience some weird results, but they can be rectified by calculating how many days are missing and then averaging the driving distance across those days OR assuming the whole mileage was for a particular day. But these are just refinements.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Dec 2017 19:52:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Calculation-based-on-customer-id/m-p/2349646#M116603</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-12-01T19:52:36Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation based on customer id</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Calculation-based-on-customer-id/m-p/2349647#M116604</link>
      <description>&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;yes i am having missing dates in between how to fill those days with zero?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Dec 2017 11:26:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Calculation-based-on-customer-id/m-p/2349647#M116604</guid>
      <dc:creator>krengan21</dc:creator>
      <dc:date>2017-12-04T11:26:49Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation based on customer id</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Calculation-based-on-customer-id/m-p/2349648#M116605</link>
      <description>&lt;P&gt;If you want to fill them with zero, then it probably makes sense to do that as a separate process after you have calculated the mileage between days (groups of days). It is a different problem to this one.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Dec 2017 13:03:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Calculation-based-on-customer-id/m-p/2349648#M116605</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-12-04T13:03:32Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation based on customer id</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Calculation-based-on-customer-id/m-p/2349649#M116606</link>
      <description>&lt;P&gt;How to populate missing dates with the value of previous date say for example&lt;/P&gt;&lt;P&gt;25-11-2017 1000&lt;/P&gt;&lt;P&gt;27-11-2017 2000&lt;/P&gt;&lt;P&gt;the missing date is 26-11-2017 how to fill it up with 25-11-2017 value using talend&lt;/P&gt;</description>
      <pubDate>Mon, 04 Dec 2017 13:06:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Calculation-based-on-customer-id/m-p/2349649#M116606</guid>
      <dc:creator>krengan21</dc:creator>
      <dc:date>2017-12-04T13:06:58Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation based on customer id</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Calculation-based-on-customer-id/m-p/2349650#M116607</link>
      <description>&lt;P&gt;This is a different question. Can you raise this question separately as it is a good question that deserves it's own spot. People searching for this sort of solution in the future will not find it if it is answered after another question with a title that does not relate to this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If the previous question was answered, can you accept the solution.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Dec 2017 13:52:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Calculation-based-on-customer-id/m-p/2349650#M116607</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-12-04T13:52:58Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation based on customer id</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Calculation-based-on-customer-id/m-p/2349651#M116608</link>
      <description>&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please find the attachment for the tmap settings as you have said.Please let me what needs to be done&lt;/P&gt;&lt;BR /&gt;&lt;A href="https://community.qlik.com/legacyfs/online/tlnd_dw_files/0683p000009LruH"&gt;tmap_settings.png&lt;/A&gt;</description>
      <pubDate>Fri, 08 Dec 2017 05:39:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Calculation-based-on-customer-id/m-p/2349651#M116608</guid>
      <dc:creator>krengan21</dc:creator>
      <dc:date>2017-12-08T05:39:22Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation based on customer id</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Calculation-based-on-customer-id/m-p/2349652#M116609</link>
      <description>&lt;P&gt;This doesn't really help. I cannot see the complete expressions and I cannot see what is wrong with the data. I *might* be able to figure something out if I could see the source data and how it is returned, but at the moment I do not even understand what the problem is.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Dec 2017 09:16:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Calculation-based-on-customer-id/m-p/2349652#M116609</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-12-08T09:16:43Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation based on customer id</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Calculation-based-on-customer-id/m-p/2349653#M116610</link>
      <description>&lt;P&gt;1. Customer_id changed ==Var.lastCustomerID==null || Var.lastCustomerID! ---&amp;gt;customerid_changed&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2.row2.customer_id --&amp;gt;&amp;nbsp;lastCustomerID&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;3.Var.customerid_changed ? row2.f1_water_pump : row2.f1_water_pump - Var.last_water_produced&amp;nbsp; --&amp;gt; var1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;4.row2.f1_water_pump --&amp;gt;last_water_produced&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please find the attachment for the screenshots for your reference&lt;/P&gt;&lt;BR /&gt;&lt;A href="https://community.qlik.com/legacyfs/online/tlnd_dw_files/0683p000009LrtZ"&gt;sortrow_properties.png&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://community.qlik.com/legacyfs/online/tlnd_dw_files/0683p000009Lrub"&gt;job screenshot.png&lt;/A&gt;</description>
      <pubDate>Fri, 08 Dec 2017 09:36:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Calculation-based-on-customer-id/m-p/2349653#M116610</guid>
      <dc:creator>krengan21</dc:creator>
      <dc:date>2017-12-08T09:36:42Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation based on customer id</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Calculation-based-on-customer-id/m-p/2349654#M116611</link>
      <description>&lt;P&gt;These expressions look wrong. For example,&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;PRE&gt;Customer_id changed ==Var.lastCustomerID==null || Var.lastCustomerID! ---&amp;gt;customerid_changed&lt;/PRE&gt; 
&lt;P&gt;....will not even compile.&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Either you have not copied exactly what I supplied or a copy an paste error has occurred here.&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;Can you double check what you have sent here please?&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Dec 2017 11:43:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Calculation-based-on-customer-id/m-p/2349654#M116611</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-12-08T11:43:42Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation based on customer id</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Calculation-based-on-customer-id/m-p/2349655#M116612</link>
      <description>&lt;P&gt;&amp;nbsp;Var.lastCustomerID==null || Var.lastCustomerID!=row2.customerId --&amp;gt;customerid_changed sorry i have pasted here wrongly&lt;/P&gt;</description>
      <pubDate>Fri, 08 Dec 2017 12:32:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Calculation-based-on-customer-id/m-p/2349655#M116612</guid>
      <dc:creator>krengan21</dc:creator>
      <dc:date>2017-12-08T12:32:31Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation based on customer id</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Calculation-based-on-customer-id/m-p/2349656#M116613</link>
      <description>&lt;P&gt;OK. They look OK.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to see the data that fails. What goes in and what goes out?&lt;/P&gt;</description>
      <pubDate>Fri, 08 Dec 2017 12:44:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Calculation-based-on-customer-id/m-p/2349656#M116613</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-12-08T12:44:52Z</dc:date>
    </item>
  </channel>
</rss>

