<?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: Split the same table load to different collums in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Split-the-same-table-load-to-different-collums/m-p/1728959#M63994</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/53261"&gt;@mestredigital&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There are several options to go about resolving your issue, I will propose two, the first one resolve your problem on the script, the second implements a solution on the front-end user interface.&lt;/P&gt;&lt;P&gt;I created a mocked QVD files with two years of sales transactions (date-sales) and a calendar as part of the solution attached (50.Split Transactions.qvf).&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Script Solution:&lt;/STRONG&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;We concatenated year 2019 transactions, renaming their date (Today) and sales fields to &lt;EM&gt;Sales_Date_2019&lt;/EM&gt; and &lt;EM&gt;Sales_Amount_2019&lt;/EM&gt; with year 2020 transactions, renaming them as &lt;EM&gt;Sales_Date_2020&lt;/EM&gt; and &lt;EM&gt;Sales_Amount_2020&lt;/EM&gt;.&lt;/LI&gt;&lt;LI&gt;The concatenation logic introduced the &lt;STRONG&gt;Date_Index&lt;/STRONG&gt; field, its expression for both sets of transactions, is: &lt;FONT face="courier new,courier"&gt;2019 + Month("Today") + Day("Today")&lt;/FONT&gt;, this field has a common value for transactions recorded on each year.&lt;/LI&gt;&lt;LI&gt;After concatenating the sales transactions, splitting them in columns by year, a summary is calculated based on the &lt;STRONG&gt;Date_Index&lt;/STRONG&gt; field, returning the &lt;FONT color="#0000FF"&gt;&lt;EM&gt;Min&lt;/EM&gt;&lt;/FONT&gt;() or &lt;FONT color="#0000FF"&gt;&lt;EM&gt;Max&lt;/EM&gt;&lt;/FONT&gt;() on the date columns (It does not matter if you use &lt;FONT color="#0000FF"&gt;Min&lt;/FONT&gt; or &lt;FONT color="#0000FF"&gt;Max&lt;/FONT&gt;), and the &lt;STRONG&gt;Sum&lt;/STRONG&gt; of the Sales figures per year; this summary flatten the data, so transactions on the same date in both years will be on the same row.&lt;/LI&gt;&lt;LI&gt;The Calendar table also feature the Date_Index field calculated with the same expression.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;User Interface (Front-End) Solution:&lt;/STRONG&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;The script does not split-concatenate-summarize the data. All this transformation is done with a Table.&lt;/LI&gt;&lt;LI&gt;The first column on this table was named "&lt;STRONG&gt;Index&lt;/STRONG&gt;", it has the expression:&amp;nbsp;&lt;FONT face="courier new,courier"&gt;2019 + Month("Tran_Date") + Day("Tran_Date")&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;Note: The table with all the sales transactions features the columns &lt;STRONG&gt;Tran_Date&lt;/STRONG&gt; and &lt;STRONG&gt;Tran_Sales&lt;/STRONG&gt; to avoid synthetic keys.&lt;/LI&gt;&lt;LI&gt;The expression for the column: &lt;STRONG&gt;Sales_Date_2019&lt;/STRONG&gt; is:&amp;nbsp; &amp;nbsp;&lt;FONT face="courier new,courier"&gt;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;Max&lt;/STRONG&gt;&lt;/FONT&gt;(If(&lt;FONT color="#0000FF"&gt;Year&lt;/FONT&gt;(Tran_Date)= 2019, Tran_Date))&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;The expression for the column: &lt;STRONG&gt;Sales_Amount_2019&lt;/STRONG&gt; is:&amp;nbsp;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;&lt;FONT color="#0000FF"&gt;Sum&lt;/FONT&gt;&lt;/STRONG&gt;(If(&lt;FONT color="#0000FF"&gt;Year&lt;/FONT&gt;(Tran_Date) = 2019, Tran_Sales, 0))&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;The expression for the columns &lt;STRONG&gt;Sales_Date_2020&lt;/STRONG&gt; and &lt;STRONG&gt;Sales_Amount_2020&lt;/STRONG&gt; applied filters for the appropriated year.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;Considerations:&lt;/STRONG&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;My sales transactions are continuous in each year without gaps, it should not be a problem if the data contains gaps (a gap is missing days).&lt;/LI&gt;&lt;LI&gt;You may need to adjust the expression used to calculated the Index column, I based its starting value on the year 2019.&lt;/LI&gt;&lt;LI&gt;The logic is valid to show sales transactions side by side.&lt;/LI&gt;&lt;LI&gt;The years 2019 and 2020 are hard-coded in the columns names, for a generic solution you should figure out a way to make them dynamic.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;Attachments&lt;/STRONG&gt;:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;The qvf application with its two QVDs.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Hope this helps,&lt;/P&gt;</description>
    <pubDate>Sat, 18 Jul 2020 00:51:51 GMT</pubDate>
    <dc:creator>ArnadoSandoval</dc:creator>
    <dc:date>2020-07-18T00:51:51Z</dc:date>
    <item>
      <title>Split the same table load to different collums</title>
      <link>https://community.qlik.com/t5/App-Development/Split-the-same-table-load-to-different-collums/m-p/1726560#M63993</link>
      <description>&lt;P&gt;Dear colleagues,&lt;/P&gt;&lt;P&gt;How can I achieve the following table desing starting from the table load below?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Table1:
Load 
	DATE as Sale_Date,
    Sum(TOTAL_SALE) as Sales_Amount
FROM [lib://QVD_FOLDER (hlbr_qlik-ti)/Sales.qvd](qvd)
WHERE ([DATE] &amp;gt;= '2019-01-01' and [DATE] &amp;lt;= '2020-12-31')
Group By DATE;


Sale_Date_2019	Sales_Amount_2019	Sale_Date_2020	Sales_Amount_2020	Daily_Difference
01/06/2019		$139.076			01/06/2020		$345.691		 	$206.615
03/06/2019		$459.111         	02/06/2020    	$535.004         	$ 75.893
04/06/2019		$721.912         	03/06/2020    	$708.563         	-$ 13.349
05/06/2019		$691.872         	04/06/2020    	$667.678         	-$ 24.194
06/06/2019		$733.013         	05/06/2020    	$632.825         	-$ 100.188
07/06/2019		$651.805         	06/06/2020    	$125.194         	-$ 526.611
08/06/2019		$44.254          	07/06/2020    	$116.795         	$ 72.541
10/06/2019		$590.524         	08/06/2020    	$604.515         	$ 13.991
11/06/2019		$859.291         	09/06/2020    	$810.381         	-$ 48.910
12/06/2019		$731.483         	10/06/2020    	$814.206         	$ 82.723
13/06/2019		$705.645         	11/06/2020    	$342.245         	-$ 363.400
14/06/2019		$697.160         	12/06/2020    	$795.376         	$ 98.217
15/06/2019		$75.646          	13/06/2020    	$141.485         	$ 65.840
17/06/2019		$822.552         	15/06/2020    	$256.999         	-$ 565.552&lt;/LI-CODE&gt;</description>
      <pubDate>Sat, 16 Nov 2024 01:56:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Split-the-same-table-load-to-different-collums/m-p/1726560#M63993</guid>
      <dc:creator>mestredigital</dc:creator>
      <dc:date>2024-11-16T01:56:16Z</dc:date>
    </item>
    <item>
      <title>Re: Split the same table load to different collums</title>
      <link>https://community.qlik.com/t5/App-Development/Split-the-same-table-load-to-different-collums/m-p/1728959#M63994</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/53261"&gt;@mestredigital&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There are several options to go about resolving your issue, I will propose two, the first one resolve your problem on the script, the second implements a solution on the front-end user interface.&lt;/P&gt;&lt;P&gt;I created a mocked QVD files with two years of sales transactions (date-sales) and a calendar as part of the solution attached (50.Split Transactions.qvf).&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Script Solution:&lt;/STRONG&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;We concatenated year 2019 transactions, renaming their date (Today) and sales fields to &lt;EM&gt;Sales_Date_2019&lt;/EM&gt; and &lt;EM&gt;Sales_Amount_2019&lt;/EM&gt; with year 2020 transactions, renaming them as &lt;EM&gt;Sales_Date_2020&lt;/EM&gt; and &lt;EM&gt;Sales_Amount_2020&lt;/EM&gt;.&lt;/LI&gt;&lt;LI&gt;The concatenation logic introduced the &lt;STRONG&gt;Date_Index&lt;/STRONG&gt; field, its expression for both sets of transactions, is: &lt;FONT face="courier new,courier"&gt;2019 + Month("Today") + Day("Today")&lt;/FONT&gt;, this field has a common value for transactions recorded on each year.&lt;/LI&gt;&lt;LI&gt;After concatenating the sales transactions, splitting them in columns by year, a summary is calculated based on the &lt;STRONG&gt;Date_Index&lt;/STRONG&gt; field, returning the &lt;FONT color="#0000FF"&gt;&lt;EM&gt;Min&lt;/EM&gt;&lt;/FONT&gt;() or &lt;FONT color="#0000FF"&gt;&lt;EM&gt;Max&lt;/EM&gt;&lt;/FONT&gt;() on the date columns (It does not matter if you use &lt;FONT color="#0000FF"&gt;Min&lt;/FONT&gt; or &lt;FONT color="#0000FF"&gt;Max&lt;/FONT&gt;), and the &lt;STRONG&gt;Sum&lt;/STRONG&gt; of the Sales figures per year; this summary flatten the data, so transactions on the same date in both years will be on the same row.&lt;/LI&gt;&lt;LI&gt;The Calendar table also feature the Date_Index field calculated with the same expression.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;User Interface (Front-End) Solution:&lt;/STRONG&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;The script does not split-concatenate-summarize the data. All this transformation is done with a Table.&lt;/LI&gt;&lt;LI&gt;The first column on this table was named "&lt;STRONG&gt;Index&lt;/STRONG&gt;", it has the expression:&amp;nbsp;&lt;FONT face="courier new,courier"&gt;2019 + Month("Tran_Date") + Day("Tran_Date")&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;Note: The table with all the sales transactions features the columns &lt;STRONG&gt;Tran_Date&lt;/STRONG&gt; and &lt;STRONG&gt;Tran_Sales&lt;/STRONG&gt; to avoid synthetic keys.&lt;/LI&gt;&lt;LI&gt;The expression for the column: &lt;STRONG&gt;Sales_Date_2019&lt;/STRONG&gt; is:&amp;nbsp; &amp;nbsp;&lt;FONT face="courier new,courier"&gt;&lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;Max&lt;/STRONG&gt;&lt;/FONT&gt;(If(&lt;FONT color="#0000FF"&gt;Year&lt;/FONT&gt;(Tran_Date)= 2019, Tran_Date))&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;The expression for the column: &lt;STRONG&gt;Sales_Amount_2019&lt;/STRONG&gt; is:&amp;nbsp;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;&lt;FONT color="#0000FF"&gt;Sum&lt;/FONT&gt;&lt;/STRONG&gt;(If(&lt;FONT color="#0000FF"&gt;Year&lt;/FONT&gt;(Tran_Date) = 2019, Tran_Sales, 0))&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;The expression for the columns &lt;STRONG&gt;Sales_Date_2020&lt;/STRONG&gt; and &lt;STRONG&gt;Sales_Amount_2020&lt;/STRONG&gt; applied filters for the appropriated year.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;Considerations:&lt;/STRONG&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;My sales transactions are continuous in each year without gaps, it should not be a problem if the data contains gaps (a gap is missing days).&lt;/LI&gt;&lt;LI&gt;You may need to adjust the expression used to calculated the Index column, I based its starting value on the year 2019.&lt;/LI&gt;&lt;LI&gt;The logic is valid to show sales transactions side by side.&lt;/LI&gt;&lt;LI&gt;The years 2019 and 2020 are hard-coded in the columns names, for a generic solution you should figure out a way to make them dynamic.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;Attachments&lt;/STRONG&gt;:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;The qvf application with its two QVDs.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Hope this helps,&lt;/P&gt;</description>
      <pubDate>Sat, 18 Jul 2020 00:51:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Split-the-same-table-load-to-different-collums/m-p/1728959#M63994</guid>
      <dc:creator>ArnadoSandoval</dc:creator>
      <dc:date>2020-07-18T00:51:51Z</dc:date>
    </item>
    <item>
      <title>Re: Split the same table load to different collums</title>
      <link>https://community.qlik.com/t5/App-Development/Split-the-same-table-load-to-different-collums/m-p/1728960#M63995</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/53261"&gt;@mestredigital&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was unable to attache the QVDs, the application has the logic to build them!&lt;/P&gt;&lt;P&gt;One last try to load them!&lt;/P&gt;</description>
      <pubDate>Sat, 18 Jul 2020 00:53:42 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Split-the-same-table-load-to-different-collums/m-p/1728960#M63995</guid>
      <dc:creator>ArnadoSandoval</dc:creator>
      <dc:date>2020-07-18T00:53:42Z</dc:date>
    </item>
  </channel>
</rss>

