<?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: Pivot multiple columns to rows in load script in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Pivot-multiple-columns-to-rows-in-load-script/m-p/1517012#M36837</link>
    <description>&lt;P&gt;That is fantastic.&amp;nbsp; Thank you!&lt;/P&gt;</description>
    <pubDate>Wed, 05 Dec 2018 19:51:10 GMT</pubDate>
    <dc:creator>carlcimino</dc:creator>
    <dc:date>2018-12-05T19:51:10Z</dc:date>
    <item>
      <title>Pivot multiple columns to rows in load script</title>
      <link>https://community.qlik.com/t5/App-Development/Pivot-multiple-columns-to-rows-in-load-script/m-p/1516955#M36821</link>
      <description>&lt;P&gt;Hello I am working on bringing data into QlikSense but need to pivot multiple columns to row values.&amp;nbsp; I can do so using CrossTable for one field but it doesn't work when I add more fields.&amp;nbsp; My script below works and pivots SER_NUM_1 - SER_NUM_4 into rows.&amp;nbsp; However I have fields MODEL_YEAR_1 - MODEL_YEAR_4 (and many other fields) that should pivot as well.&amp;nbsp; How does one pivot more than one attribute field?&amp;nbsp; In the screen print you can see that VIN_NUMBER contains stacked VIN and MODEL YEar but I want a column that says Model Year.&lt;/P&gt;&lt;P&gt;crosstable(UNIT_ID, VIN_NUMBER, 16)&lt;BR /&gt;load *&lt;BR /&gt;;&lt;BR /&gt;Select&lt;BR /&gt;cast(replicate('0',12-len(ltrim(rtrim(a.POLICY_NO))))+ltrim(rtrim(a.POLICY_NO)) as varchar(99)) as POLICY_NUMBER&lt;BR /&gt;, replicate('0',7-len(a.AGENT_NO))+a.AGENT_NO as PROD_N&lt;BR /&gt;, a.SUB_AGENT as SUB_PROD_N&lt;BR /&gt;, a.COMPANY_CODE&lt;BR /&gt;, DATEADD(YEAR, -1,a.EXPRN_DATE) as EFFECTIVE_DATE&lt;BR /&gt;, a.EXPRN_DATE as EXPIRATION_DATE&lt;BR /&gt;, left(a.AS_OF_YYYYMMDD,6) as AS_OF_YYYYMM&lt;BR /&gt;, a.NO_OF_CARS as NUMBER_OF_VEHICLES&lt;BR /&gt;, a.NO_OF_DRVRS as NUMBER_OF_DRIVERS&lt;BR /&gt;, a.SCR_SCORE as INSURANCE_SCORE&lt;BR /&gt;, a.NAME_INSD1 as INSURED_NAME&lt;BR /&gt;, a.INSD_STREET as MAILING_ADDRESS&lt;BR /&gt;, a.INSD_CITY as MAILING_CITY&lt;BR /&gt;, a.INSD_STATE as MAILING_STATE&lt;BR /&gt;, a.INSD_ZIP as MAILING_ZIPCODE&lt;BR /&gt;, a.TOT_TRM_PRM&lt;BR /&gt;, a.SER_NUM_1&lt;BR /&gt;, a.SER_NUM_2&lt;BR /&gt;, a.SER_NUM_3&lt;BR /&gt;, a.SER_NUM_4&lt;BR /&gt;From stg_prs_qpmis.vw_caasmstr a (nolock)&lt;BR /&gt;where ltrim(rtrim(a.POLICY_NO))='15966244'&lt;BR /&gt;;&lt;BR /&gt;exit script;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 07:07:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Pivot-multiple-columns-to-rows-in-load-script/m-p/1516955#M36821</guid>
      <dc:creator>carlcimino</dc:creator>
      <dc:date>2024-11-16T07:07:20Z</dc:date>
    </item>
    <item>
      <title>Re: Pivot multiple columns to rows in load script</title>
      <link>https://community.qlik.com/t5/App-Development/Pivot-multiple-columns-to-rows-in-load-script/m-p/1516977#M36824</link>
      <description>&lt;P&gt;You can first create new fields that are combinations of the model year and serial:&amp;nbsp;MODEL_YR1 &amp;amp; '|' &amp;amp; SER_NUM_1 as FIELD_1 ...etc. These new fields you can pivot using the crosstable function. Then from the table with the pivotted values you need to create a new table where you split the combined&amp;nbsp;values again into separate fields using the subfield function: SubField(VIN_NUMBER, '|' , 1 ) as MODEL_YEAR,&amp;nbsp;&lt;SPAN&gt;SubField(VIN_NUMBER, '|' , 2) as SER_NUM&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Dec 2018 17:57:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Pivot-multiple-columns-to-rows-in-load-script/m-p/1516977#M36824</guid>
      <dc:creator>Gysbert_Wassenaar</dc:creator>
      <dc:date>2018-12-05T17:57:01Z</dc:date>
    </item>
    <item>
      <title>Re: Pivot multiple columns to rows in load script</title>
      <link>https://community.qlik.com/t5/App-Development/Pivot-multiple-columns-to-rows-in-load-script/m-p/1517012#M36837</link>
      <description>&lt;P&gt;That is fantastic.&amp;nbsp; Thank you!&lt;/P&gt;</description>
      <pubDate>Wed, 05 Dec 2018 19:51:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Pivot-multiple-columns-to-rows-in-load-script/m-p/1517012#M36837</guid>
      <dc:creator>carlcimino</dc:creator>
      <dc:date>2018-12-05T19:51:10Z</dc:date>
    </item>
  </channel>
</rss>

