<?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 QS Pivot Table Sorting with Set Expression in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/QS-Pivot-Table-Sorting-with-Set-Expression/m-p/1803749#M1211925</link>
    <description>&lt;P&gt;Hello, I´m trying to implement Pivot Table Sorting with the help of this link&amp;nbsp;&lt;A href="https://www.youtube.com/watch?v=iiMlRVJWmsk" target="_blank"&gt;https://www.youtube.com/watch?v=iiMlRVJWmsk&lt;/A&gt;&lt;/P&gt;&lt;P&gt;My problem is that I need to use the ' sign in my formula. Since the entire formula needs to be put into a variable as text with ' sign, then the SET expression and If statement don´t work. I tried to use chr(39) in the SET expression and if statement, which works perfectly in a text box, but not when I´m using the variable input buttons.&lt;/P&gt;&lt;P&gt;Original expression that I want to use for sorting:&lt;/P&gt;&lt;P&gt;-sum({&amp;lt;Version={'Actuals'}&amp;gt;} if(DisplayCurrency='SEK',Amount/FactorNr, if(DisplayCurrency='EUR',AmountEUR/FactorNr, if(DisplayCurrency='DKK',AmountDKK/FactorNr, if(DisplayCurrency='NOK',AmountNOK/FactorNr,'0')))))&lt;/P&gt;&lt;P&gt;I tried this for the variable input:&lt;/P&gt;&lt;P&gt;'sum({&amp;lt;Version={'&amp;amp;chr(39)&amp;amp;'Actuals'&amp;amp;chr(39)&amp;amp;'}&amp;gt;} if(DisplayCurrency='&amp;amp;chr(39)&amp;amp;'SEK'&amp;amp;chr(39)&amp;amp;',Amount/FactorNr, if(DisplayCurrency='&amp;amp;chr(39)&amp;amp;'EUR'&amp;amp;chr(39)&amp;amp;',AmountEUR/FactorNr, if(DisplayCurrency='&amp;amp;chr(39)&amp;amp;'DKK'&amp;amp;chr(39)&amp;amp;',AmountDKK/FactorNr, if(DisplayCurrency='&amp;amp;chr(39)&amp;amp;'NOK'&amp;amp;chr(39)&amp;amp;',AmountNOK/FactorNr,'&amp;amp;chr(39)&amp;amp;'0'&amp;amp;chr(39)&amp;amp;')))))'&amp;amp;'~one|2~two'&lt;/P&gt;&lt;P&gt;The first chr(39) seems to be interpreted as '. But as soon as I put in anything after the first chr(39), then the variable vPivotSort gets blank.&amp;nbsp; For example&amp;nbsp;'sum({&amp;lt;Version={'&amp;amp;chr(39) works fine, but&amp;nbsp;'sum({&amp;lt;Version={'&amp;amp;chr(39)&amp;amp;'Actuals' gives me a blank variable.&lt;/P&gt;&lt;P&gt;What can I do to solve this problem?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 29 Apr 2021 09:15:18 GMT</pubDate>
    <dc:creator>JohanLind1979</dc:creator>
    <dc:date>2021-04-29T09:15:18Z</dc:date>
    <item>
      <title>QS Pivot Table Sorting with Set Expression</title>
      <link>https://community.qlik.com/t5/QlikView/QS-Pivot-Table-Sorting-with-Set-Expression/m-p/1803749#M1211925</link>
      <description>&lt;P&gt;Hello, I´m trying to implement Pivot Table Sorting with the help of this link&amp;nbsp;&lt;A href="https://www.youtube.com/watch?v=iiMlRVJWmsk" target="_blank"&gt;https://www.youtube.com/watch?v=iiMlRVJWmsk&lt;/A&gt;&lt;/P&gt;&lt;P&gt;My problem is that I need to use the ' sign in my formula. Since the entire formula needs to be put into a variable as text with ' sign, then the SET expression and If statement don´t work. I tried to use chr(39) in the SET expression and if statement, which works perfectly in a text box, but not when I´m using the variable input buttons.&lt;/P&gt;&lt;P&gt;Original expression that I want to use for sorting:&lt;/P&gt;&lt;P&gt;-sum({&amp;lt;Version={'Actuals'}&amp;gt;} if(DisplayCurrency='SEK',Amount/FactorNr, if(DisplayCurrency='EUR',AmountEUR/FactorNr, if(DisplayCurrency='DKK',AmountDKK/FactorNr, if(DisplayCurrency='NOK',AmountNOK/FactorNr,'0')))))&lt;/P&gt;&lt;P&gt;I tried this for the variable input:&lt;/P&gt;&lt;P&gt;'sum({&amp;lt;Version={'&amp;amp;chr(39)&amp;amp;'Actuals'&amp;amp;chr(39)&amp;amp;'}&amp;gt;} if(DisplayCurrency='&amp;amp;chr(39)&amp;amp;'SEK'&amp;amp;chr(39)&amp;amp;',Amount/FactorNr, if(DisplayCurrency='&amp;amp;chr(39)&amp;amp;'EUR'&amp;amp;chr(39)&amp;amp;',AmountEUR/FactorNr, if(DisplayCurrency='&amp;amp;chr(39)&amp;amp;'DKK'&amp;amp;chr(39)&amp;amp;',AmountDKK/FactorNr, if(DisplayCurrency='&amp;amp;chr(39)&amp;amp;'NOK'&amp;amp;chr(39)&amp;amp;',AmountNOK/FactorNr,'&amp;amp;chr(39)&amp;amp;'0'&amp;amp;chr(39)&amp;amp;')))))'&amp;amp;'~one|2~two'&lt;/P&gt;&lt;P&gt;The first chr(39) seems to be interpreted as '. But as soon as I put in anything after the first chr(39), then the variable vPivotSort gets blank.&amp;nbsp; For example&amp;nbsp;'sum({&amp;lt;Version={'&amp;amp;chr(39) works fine, but&amp;nbsp;'sum({&amp;lt;Version={'&amp;amp;chr(39)&amp;amp;'Actuals' gives me a blank variable.&lt;/P&gt;&lt;P&gt;What can I do to solve this problem?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Apr 2021 09:15:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/QS-Pivot-Table-Sorting-with-Set-Expression/m-p/1803749#M1211925</guid>
      <dc:creator>JohanLind1979</dc:creator>
      <dc:date>2021-04-29T09:15:18Z</dc:date>
    </item>
  </channel>
</rss>

