<?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 field value based on date changed. in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Calculation-field-value-based-on-date-changed/m-p/1545564#M439826</link>
    <description>&lt;P&gt;Hi Community,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I updated my case, and I still can't find the correct output.&amp;nbsp; Does anyone have any idea or suggestion?&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 18 Feb 2019 02:31:53 GMT</pubDate>
    <dc:creator>febridwi</dc:creator>
    <dc:date>2019-02-18T02:31:53Z</dc:date>
    <item>
      <title>Calculation field value based on date changed.</title>
      <link>https://community.qlik.com/t5/QlikView/Calculation-field-value-based-on-date-changed/m-p/1543359#M439607</link>
      <description>&lt;P&gt;Hi everyone,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I back to play around with QV, and I got a sample case from my team. This case about &lt;EM&gt;how to calculate&amp;nbsp;the price value based on different date price valid&lt;/EM&gt;.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I've tried the suggestion from prev comments but it wasn't given the correct amount. Currently, I try to use set analysis which gets the TGL TRANSAKSI between DateFrom &amp;amp; DateTo, the set analysis:&amp;nbsp;sum({$&amp;lt;[TGL TRANSAKSI]={"&amp;gt;=$([DateFrom])"}, [TGL TRANSAKSI]={"&amp;lt; $([DateTo])"}&amp;gt;} QTY * HARGA) But that set analysis doesn't get the TGL TRANSAKSI, Is there any wrong with my set analysis? &lt;/SPAN&gt;&lt;SPAN&gt;Does anyone have an idea? &lt;/SPAN&gt;&lt;SPAN&gt;I'm quite stuck.&amp;nbsp; Have a good day!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I attache the qvw and the data, maybe it could help &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Regards,&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Febri.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 04:28:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculation-field-value-based-on-date-changed/m-p/1543359#M439607</guid>
      <dc:creator>febridwi</dc:creator>
      <dc:date>2024-11-16T04:28:16Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation Price field based on date changed.</title>
      <link>https://community.qlik.com/t5/QlikView/Calculation-field-value-based-on-date-changed/m-p/1543368#M439609</link>
      <description>&lt;P&gt;Use an interval match to join the prices to the fact data table:&lt;/P&gt;&lt;PRE&gt;T_Price:
LOAD * Inline
[PRODUCT, PRICE, DATEVALID
A, 1000, 01/01/2019
A, 2000, 15/01/2019
];
&lt;BR /&gt;// Construct the match table
T_Match:
LOAD PRODUCT, 
	DATEVALID as DateFrom,	
	If(PRODUCT = Previous(PRODUCT),
		Previous(DATEVALID) - 1/86400,   // less by 1 second
		1E6  // far into the future
	) as DateTo,

	PRICE
Resident T_Price
ORDER By PRODUCT, DATEVALID DESC;

DROP Table T_PRICE;

DATA:
LOAD * Inline
[PRODUCT, QTY, DATETRANS
A, 100, 01/01/2019
A, 100, 09/01/2019
A, 100, 11/01/2019
A, 50, 16/01/2019
A, 50, 25/01/2019
];

Left Join (DATA)
IntervalMatch(DATETRANS, PRODUCT)  // extended interval match
LOAD DateFrom,
	DateTo,
	PRODUCT,
	PRICE
Resident T_Match;

&lt;EM&gt;//Optional cleanup of syn key
Left Join (DATA)
LOAD * Resident T_Match;

DROP Table T_Match;
DROP Field DateFrom, DateTo;&lt;/EM&gt;&lt;/PRE&gt;&lt;P&gt;Now use PRODUCT as a dimension, Sum(QTY) and Sum(QTY*PRICE) as measures/expressions.&lt;/P&gt;&lt;P&gt;** Note this assumes that the from dates in the price table fully cover the dates in the fact table&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Feb 2019 05:32:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculation-field-value-based-on-date-changed/m-p/1543368#M439609</guid>
      <dc:creator>jonathandienst</dc:creator>
      <dc:date>2019-02-13T05:32:52Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation Price field based on date changed.</title>
      <link>https://community.qlik.com/t5/QlikView/Calculation-field-value-based-on-date-changed/m-p/1543411#M439619</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/14931"&gt;@jonathandienst&lt;/a&gt;&lt;/P&gt;&lt;P&gt;Thank you for replying my sample case.. I'm working on it.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;update: Unfortunately, I don't get the correct answer following your suggestion.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Feb 2019 07:06:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculation-field-value-based-on-date-changed/m-p/1543411#M439619</guid>
      <dc:creator>febridwi</dc:creator>
      <dc:date>2019-02-13T07:06:26Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation Price field based on date changed.</title>
      <link>https://community.qlik.com/t5/QlikView/Calculation-field-value-based-on-date-changed/m-p/1544002#M439674</link>
      <description>&lt;P&gt;Does anyone have an idea??&lt;/P&gt;</description>
      <pubDate>Thu, 14 Feb 2019 03:36:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculation-field-value-based-on-date-changed/m-p/1544002#M439674</guid>
      <dc:creator>febridwi</dc:creator>
      <dc:date>2019-02-14T03:36:00Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation field value based on date changed.</title>
      <link>https://community.qlik.com/t5/QlikView/Calculation-field-value-based-on-date-changed/m-p/1545564#M439826</link>
      <description>&lt;P&gt;Hi Community,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I updated my case, and I still can't find the correct output.&amp;nbsp; Does anyone have any idea or suggestion?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Feb 2019 02:31:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Calculation-field-value-based-on-date-changed/m-p/1545564#M439826</guid>
      <dc:creator>febridwi</dc:creator>
      <dc:date>2019-02-18T02:31:53Z</dc:date>
    </item>
  </channel>
</rss>

