<?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: Set Expression doesn't seem to work in FirstSortedValue in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Set-Expression-doesn-t-seem-to-work-in-FirstSortedValue/m-p/412499#M487954</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you need to do the sum in the script and use firstsortedvalue after that, so resolve&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12.727272033691406px; color: #737373; font-family: Arial;"&gt;Aggr(((Sum({&amp;lt;VEItemLedgerTypeCode = {1}&amp;gt;} VESalesAmountActual&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12.727272033691406px; color: #737373; font-family: Arial;"&gt;-&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12.727272033691406px; color: #737373; font-family: Arial;"&gt;- VECostAmountActual))&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12.727272033691406px; color: #737373; font-family: Arial;"&gt;/&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12.727272033691406px; color: #737373; font-family: Arial;"&gt;Sum({&amp;lt;VEItemLedgerTypeCode = {1}&amp;gt;}VESalesAmountActual)&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12.727272033691406px; color: #737373; font-family: Arial;"&gt;*&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12.727272033691406px; color: #737373; font-family: Arial;"&gt;100),ItemNo)) using group by&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12.727272033691406px; color: #737373; font-family: Arial;"&gt;your expression will be &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12.727272033691406px; color: #737373; font-family: Arial;"&gt;aggr(FirstSortedValue( ItemNo, - SalesTotalResult), ItemNo)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12.727272033691406px; color: #737373; font-family: Arial;"&gt;Hope this helps&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 13 Feb 2013 12:58:10 GMT</pubDate>
    <dc:creator>chematos</dc:creator>
    <dc:date>2013-02-13T12:58:10Z</dc:date>
    <item>
      <title>Set Expression doesn't seem to work in FirstSortedValue</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Expression-doesn-t-seem-to-work-in-FirstSortedValue/m-p/412496#M487951</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In my dashboard I have to create an expression which does the following thing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to know wich Item has the highest Index Margin.&lt;/P&gt;&lt;P&gt;For this KPI I created een expression with the FirstSortedValue function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=FirstSortedValue(ItemNo, -Aggr(((Sum({&amp;lt;VEItemLedgerTypeCode = {1}&amp;gt;} VESalesAmountActual &lt;/P&gt;&lt;P&gt;- &lt;/P&gt;&lt;P&gt;- VECostAmountActual))&lt;/P&gt;&lt;P&gt;/&lt;/P&gt;&lt;P&gt;Sum({&amp;lt;VEItemLedgerTypeCode = {1}&amp;gt;}VESalesAmountActual)&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;100),ItemNo))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With this expression I know wich Item has the highest Index Margin.&lt;/P&gt;&lt;P&gt;Only now I want to create an expression where I can set the store id.&lt;/P&gt;&lt;P&gt;I created an expression like this;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=FirstSortedValue({&amp;lt;StoreNo = {'110_Base'}&amp;gt;} ItemNo, -Aggr(((Sum({&amp;lt;VEItemLedgerTypeCode = {1}&amp;gt;} VESalesAmountActual &lt;/P&gt;&lt;P&gt;- &lt;/P&gt;&lt;P&gt;- VECostAmountActual))&lt;/P&gt;&lt;P&gt;/&lt;/P&gt;&lt;P&gt;Sum({&amp;lt;VEItemLedgerTypeCode = {1}&amp;gt;}VESalesAmountActual)&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;100),ItemNo))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also tried to create a set expression where the expression does not react on any selection in the dashboard. Normaly you can do this with an 1 like this &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=FirstSortedValue({1}ItemNo, -Aggr(((Sum({&amp;lt;VEItemLedgerTypeCode = {1}&amp;gt;} VESalesAmountActual &lt;/P&gt;&lt;P&gt;- &lt;/P&gt;&lt;P&gt;- VECostAmountActual))&lt;/P&gt;&lt;P&gt;/&lt;/P&gt;&lt;P&gt;Sum({&amp;lt;VEItemLedgerTypeCode = {1}&amp;gt;}VESalesAmountActual)&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;100),ItemNo))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But also this doesn;t seem to work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However the expression works the same as the first one. It seems that the expression does not react on the given set expression ({&amp;lt;StoreNo = {'110_Base'}&amp;gt;})&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Eventually I want to achieve the following;&lt;/P&gt;&lt;P&gt; Sales * the highest Index Margin over all stores - the highest Margin from a specific store.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope someone can help me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Feb 2013 08:19:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Expression-doesn-t-seem-to-work-in-FirstSortedValue/m-p/412496#M487951</guid>
      <dc:creator>jjordaan</dc:creator>
      <dc:date>2013-02-07T08:19:51Z</dc:date>
    </item>
    <item>
      <title>Re: Set Expression doesn't seem to work in FirstSortedValue</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Expression-doesn-t-seem-to-work-in-FirstSortedValue/m-p/412497#M487952</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;QlikView Specialists,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there anyone that can help me?&lt;/P&gt;&lt;P&gt;I hope that you can create some time for me to help with this problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Feb 2013 09:58:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Expression-doesn-t-seem-to-work-in-FirstSortedValue/m-p/412497#M487952</guid>
      <dc:creator>jjordaan</dc:creator>
      <dc:date>2013-02-11T09:58:22Z</dc:date>
    </item>
    <item>
      <title>Re: Set Expression doesn't seem to work in FirstSortedValue</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Expression-doesn-t-seem-to-work-in-FirstSortedValue/m-p/412498#M487953</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #737373; font-family: Arial; background-color: #ffffff;"&gt;I hope somebody can help me with this issue&lt;/SPAN&gt;!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Feb 2013 10:05:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Expression-doesn-t-seem-to-work-in-FirstSortedValue/m-p/412498#M487953</guid>
      <dc:creator>jjordaan</dc:creator>
      <dc:date>2013-02-13T10:05:24Z</dc:date>
    </item>
    <item>
      <title>Re: Set Expression doesn't seem to work in FirstSortedValue</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Expression-doesn-t-seem-to-work-in-FirstSortedValue/m-p/412499#M487954</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you need to do the sum in the script and use firstsortedvalue after that, so resolve&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12.727272033691406px; color: #737373; font-family: Arial;"&gt;Aggr(((Sum({&amp;lt;VEItemLedgerTypeCode = {1}&amp;gt;} VESalesAmountActual&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12.727272033691406px; color: #737373; font-family: Arial;"&gt;-&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12.727272033691406px; color: #737373; font-family: Arial;"&gt;- VECostAmountActual))&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12.727272033691406px; color: #737373; font-family: Arial;"&gt;/&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12.727272033691406px; color: #737373; font-family: Arial;"&gt;Sum({&amp;lt;VEItemLedgerTypeCode = {1}&amp;gt;}VESalesAmountActual)&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12.727272033691406px; color: #737373; font-family: Arial;"&gt;*&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12.727272033691406px; color: #737373; font-family: Arial;"&gt;100),ItemNo)) using group by&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12.727272033691406px; color: #737373; font-family: Arial;"&gt;your expression will be &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12.727272033691406px; color: #737373; font-family: Arial;"&gt;aggr(FirstSortedValue( ItemNo, - SalesTotalResult), ItemNo)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; font-size: 12.727272033691406px; color: #737373; font-family: Arial;"&gt;Hope this helps&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Feb 2013 12:58:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Expression-doesn-t-seem-to-work-in-FirstSortedValue/m-p/412499#M487954</guid>
      <dc:creator>chematos</dc:creator>
      <dc:date>2013-02-13T12:58:10Z</dc:date>
    </item>
    <item>
      <title>Re: Set Expression doesn't seem to work in FirstSortedValue</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Expression-doesn-t-seem-to-work-in-FirstSortedValue/m-p/412500#M487955</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;José,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your reaction.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The calculation of the Index Margin is working fine.&lt;/P&gt;&lt;P&gt;The only that isn't working is if I want to calculated for a certain store.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm using the expression below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; color: #737373; font-family: Arial;"&gt;=FirstSortedValue({&amp;lt;StoreNo = {'110_Base'}&amp;gt;} ItemNo, -Aggr(((Sum({&amp;lt;VEItemLedgerTypeCode = {1}&amp;gt;} VESalesAmountActual&lt;/P&gt;&lt;P style="background-color: #ffffff; color: #737373; font-family: Arial;"&gt;-&lt;/P&gt;&lt;P style="background-color: #ffffff; color: #737373; font-family: Arial;"&gt;- VECostAmountActual))&lt;/P&gt;&lt;P style="background-color: #ffffff; color: #737373; font-family: Arial;"&gt;/&lt;/P&gt;&lt;P style="background-color: #ffffff; color: #737373; font-family: Arial;"&gt;Sum({&amp;lt;VEItemLedgerTypeCode = {1}&amp;gt;}VESalesAmountActual)&lt;/P&gt;&lt;P style="background-color: #ffffff; color: #737373; font-family: Arial;"&gt;*&lt;/P&gt;&lt;P style="background-color: #ffffff; color: #737373; font-family: Arial;"&gt;100),ItemNo))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; color: #737373; font-family: Arial;"&gt;With a set expression (&lt;SPAN style="color: #737373; font-family: Arial; background-color: #ffffff;"&gt;{&amp;lt;StoreNo = {'110_Base'}&amp;gt;}&lt;/SPAN&gt;) I only want to calculated the Index Margin of that store.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="background-color: #ffffff; color: #737373; font-family: Arial;"&gt;But with this expression I also get the result over all stores&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Feb 2013 14:14:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Expression-doesn-t-seem-to-work-in-FirstSortedValue/m-p/412500#M487955</guid>
      <dc:creator>jjordaan</dc:creator>
      <dc:date>2013-02-13T14:14:14Z</dc:date>
    </item>
    <item>
      <title>Re: Set Expression doesn't seem to work in FirstSortedValue</title>
      <link>https://community.qlik.com/t5/QlikView/Set-Expression-doesn-t-seem-to-work-in-FirstSortedValue/m-p/412501#M487956</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I resolved the issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I added another a second dimension in the Aggr function.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Feb 2013 16:33:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Set-Expression-doesn-t-seem-to-work-in-FirstSortedValue/m-p/412501#M487956</guid>
      <dc:creator>jjordaan</dc:creator>
      <dc:date>2013-02-14T16:33:21Z</dc:date>
    </item>
  </channel>
</rss>

