<?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 Get the dimension value associated to a max expression in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Get-the-dimension-value-associated-to-a-max-expression/m-p/174341#M43200</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;got the right results with the following formula and your data you provided in the excel sheet, you will need to verify that it works for all your scenarios.&lt;/P&gt;&lt;P&gt;When you get a '-' result in many cases the evaluation of the formula breaks (e.g. wrong spelling, unmatching brackets etc) and it will return NULL, represented as '-'&lt;/P&gt;&lt;P&gt;subfield(concat(aggr(nodistinct rank(sum(Sales)) &amp;amp; '#' &amp;amp; Date &amp;amp; '#',Date)),'#',rank(sum(Sales))*2)&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Juerg&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 07 Jun 2010 16:58:32 GMT</pubDate>
    <dc:creator />
    <dc:date>2010-06-07T16:58:32Z</dc:date>
    <item>
      <title>Get the dimension value associated to a max expression</title>
      <link>https://community.qlik.com/t5/QlikView/Get-the-dimension-value-associated-to-a-max-expression/m-p/174335#M43194</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to get the dimension value associated to the corresponding expression which is maximal.&lt;BR /&gt;I mean, let's say i have in a table:&lt;/P&gt;&lt;P&gt;Country - Date - Business - Sales&lt;/P&gt;&lt;P&gt;And i woud like to have in a chart (or in any other way) , per country, the date which matches the maximum value of sales.&lt;BR /&gt;I so created a chart with dimensions:&lt;/P&gt;&lt;P&gt;Country&lt;/P&gt;&lt;P&gt;as expression : ????&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot for your help ! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Jun 2010 15:37:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Get-the-dimension-value-associated-to-a-max-expression/m-p/174335#M43194</guid>
      <dc:creator />
      <dc:date>2010-06-02T15:37:21Z</dc:date>
    </item>
    <item>
      <title>Get the dimension value associated to a max expression</title>
      <link>https://community.qlik.com/t5/QlikView/Get-the-dimension-value-associated-to-a-max-expression/m-p/174336#M43195</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;look at this thread, Martin has shown a way how to accomplish this&lt;/P&gt;&lt;P&gt;&lt;A href="http://community.qlik.com/forums/p/28631/109983.aspx#109983"&gt;http://community.qlik.com/forums/p/28631/109983.aspx#109983&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Juerg&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Jun 2010 16:00:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Get-the-dimension-value-associated-to-a-max-expression/m-p/174336#M43195</guid>
      <dc:creator />
      <dc:date>2010-06-02T16:00:31Z</dc:date>
    </item>
    <item>
      <title>Get the dimension value associated to a max expression</title>
      <link>https://community.qlik.com/t5/QlikView/Get-the-dimension-value-associated-to-a-max-expression/m-p/174337#M43196</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;WEll, unfortunately, i don't have (yet) a QV licence...&lt;BR /&gt;So i can't open the file within the topic....&lt;/P&gt;&lt;P&gt;My new formula is this one :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;&lt;BR /&gt;TABLE :&lt;BR /&gt;ElementID&lt;BR /&gt;Stat_PFT&lt;BR /&gt;Stat_Date&lt;BR /&gt;Stat_Nb&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;Chart elements&lt;/P&gt;&lt;P&gt;&lt;I&gt;- As dimensions:&lt;BR /&gt;Stats_PFT&lt;BR /&gt;&lt;/I&gt;ElementID&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-style: italic"&gt;-As expression&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;&lt;BR /&gt;=if(Stat_Nb = aggr(max(Stat_Nb),Stat_PFT,ElementID,Stat_Date)&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;P&gt;Unfortunately this still doesn't work &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;And i don't really understand the other topic without the QVD &lt;span class="lia-unicode-emoji" title=":neutral_face:"&gt;😐&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone help me on this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Jun 2010 16:01:05 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Get-the-dimension-value-associated-to-a-max-expression/m-p/174337#M43196</guid>
      <dc:creator />
      <dc:date>2010-06-04T16:01:05Z</dc:date>
    </item>
    <item>
      <title>Get the dimension value associated to a max expression</title>
      <link>https://community.qlik.com/t5/QlikView/Get-the-dimension-value-associated-to-a-max-expression/m-p/174338#M43197</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I can't recognize the elements you listed in your second post.&lt;/P&gt;&lt;P&gt;You fist talked of County - Date- Business - Sales, now it is&lt;/P&gt;&lt;P&gt;ElementID, Stat_PFT, Stat_Date, Stat_Nb&lt;/P&gt;&lt;P&gt;What do you get then with this formula in your case?&lt;/P&gt;&lt;P&gt;subfield(concat(aggr(rank(sum(total &amp;lt;Stat_Pft,ElementID&amp;gt; Stat_Nb)) &amp;amp; '#' &amp;amp; Stat_Pft &amp;amp; ',' &amp;amp; ElementID &amp;amp; '#)),'#',2)&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Jürg&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Jun 2010 07:18:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Get-the-dimension-value-associated-to-a-max-expression/m-p/174338#M43197</guid>
      <dc:creator />
      <dc:date>2010-06-07T07:18:39Z</dc:date>
    </item>
    <item>
      <title>Get the dimension value associated to a max expression</title>
      <link>https://community.qlik.com/t5/QlikView/Get-the-dimension-value-associated-to-a-max-expression/m-p/174339#M43198</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry, the meaning of the fields is quite similar.&lt;/P&gt;&lt;P style="font-style: italic"&gt;County -&amp;gt; Stat_PTF&lt;BR /&gt;Date-&amp;gt; Stat_Date&lt;BR /&gt;Business-&amp;gt; ElementID&lt;BR /&gt;Sales -&amp;gt; Stats_NbTraps&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried your formula but it doesn't seem to be working.... It displays '-'... &lt;IMG alt="Indifferent" src="http://community.qlik.com/emoticons/emotion-8.gif" /&gt;&lt;I&gt;&lt;BR /&gt;&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance for your help ^^ I'm a bit lost in those "complicated' formulas .... &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Jun 2010 15:01:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Get-the-dimension-value-associated-to-a-max-expression/m-p/174339#M43198</guid>
      <dc:creator />
      <dc:date>2010-06-07T15:01:43Z</dc:date>
    </item>
    <item>
      <title>Get the dimension value associated to a max expression</title>
      <link>https://community.qlik.com/t5/QlikView/Get-the-dimension-value-associated-to-a-max-expression/m-p/174340#M43199</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Attached: a file explaining what i would like to have.... i hope it became clearer with it ^^&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Jun 2010 15:13:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Get-the-dimension-value-associated-to-a-max-expression/m-p/174340#M43199</guid>
      <dc:creator />
      <dc:date>2010-06-07T15:13:16Z</dc:date>
    </item>
    <item>
      <title>Get the dimension value associated to a max expression</title>
      <link>https://community.qlik.com/t5/QlikView/Get-the-dimension-value-associated-to-a-max-expression/m-p/174341#M43200</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;got the right results with the following formula and your data you provided in the excel sheet, you will need to verify that it works for all your scenarios.&lt;/P&gt;&lt;P&gt;When you get a '-' result in many cases the evaluation of the formula breaks (e.g. wrong spelling, unmatching brackets etc) and it will return NULL, represented as '-'&lt;/P&gt;&lt;P&gt;subfield(concat(aggr(nodistinct rank(sum(Sales)) &amp;amp; '#' &amp;amp; Date &amp;amp; '#',Date)),'#',rank(sum(Sales))*2)&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Juerg&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Jun 2010 16:58:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Get-the-dimension-value-associated-to-a-max-expression/m-p/174341#M43200</guid>
      <dc:creator />
      <dc:date>2010-06-07T16:58:32Z</dc:date>
    </item>
    <item>
      <title>Get the dimension value associated to a max expression</title>
      <link>https://community.qlik.com/t5/QlikView/Get-the-dimension-value-associated-to-a-max-expression/m-p/174342#M43201</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your Help Juerg,it's perfectly working on the sample i provided you.&lt;/P&gt;&lt;P&gt;In fact, my data are based on some incidents raised by an application.So you don't always have value for a specific date, so the end of your formula doesn't seem to be working (the "rank(sum(Sales))*2)"). I've thought about improving it by replacing the "2" by a Count(Sales)....&lt;/P&gt;&lt;P&gt;Anyway, i'm looking for a max value (but as i have only one value per date, max is similar to sum? ). In fact, for a specific value, the&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;&lt;BR /&gt;(aggr(nodistinct rank(sum(Sales)) &amp;amp; '#' &amp;amp; Date &amp;amp; '#',Date)),&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;doesn't always return the good value.... If U want, i can send you by PM the QVW file... &lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Jun 2010 19:10:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Get-the-dimension-value-associated-to-a-max-expression/m-p/174342#M43201</guid>
      <dc:creator />
      <dc:date>2010-06-07T19:10:15Z</dc:date>
    </item>
    <item>
      <title>Get the dimension value associated to a max expression</title>
      <link>https://community.qlik.com/t5/QlikView/Get-the-dimension-value-associated-to-a-max-expression/m-p/174343#M43202</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;Thought it might not work. Just a quick question, I see that lots of your live data has Sale=1 for many dates. What is the expected result (which date to show) and do you want to show the max per day or rather per week or month?&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Jürg&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Jun 2010 07:04:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Get-the-dimension-value-associated-to-a-max-expression/m-p/174343#M43202</guid>
      <dc:creator />
      <dc:date>2010-06-08T07:04:03Z</dc:date>
    </item>
    <item>
      <title>Get the dimension value associated to a max expression</title>
      <link>https://community.qlik.com/t5/QlikView/Get-the-dimension-value-associated-to-a-max-expression/m-p/174344#M43203</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;Another idea but will disregard selected date ranges - evaluating the best selling day while loading the data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;PRE style="margin: 0px;"&gt;&lt;BR /&gt;sales:&lt;BR /&gt;LOAD Country &amp;amp; Business as %key,&lt;BR /&gt;Country,&lt;BR /&gt; Business,&lt;BR /&gt; date(Date) as Date,&lt;BR /&gt; Sales&lt;BR /&gt;FROM&lt;BR /&gt;D:\BI\QlikView\Examples\Chart_dim_of_max_value.xls&lt;BR /&gt;(biff, embedded labels, table is Sheet1$);&lt;BR /&gt;best:&lt;BR /&gt;LOAD %key&lt;BR /&gt;,firstsortedvalue(distinct Date,-Sales) as bestDate&lt;BR /&gt;RESIDENT sales&lt;BR /&gt;GROUP BY %key;&lt;BR /&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;Then simply add the bestDate into your table&lt;/P&gt;&lt;P&gt;Edit: Looked at the "firstortedvalue" in the load command but it is also available as chart expression. So using it in the chart will give you the best date within your selected date range.&lt;/P&gt;&lt;P&gt;=firstsortedvalue(distinct Date,-Sales)&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Jürg&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Jun 2010 07:30:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Get-the-dimension-value-associated-to-a-max-expression/m-p/174344#M43203</guid>
      <dc:creator />
      <dc:date>2010-06-08T07:30:15Z</dc:date>
    </item>
    <item>
      <title>Get the dimension value associated to a max expression</title>
      <link>https://community.qlik.com/t5/QlikView/Get-the-dimension-value-associated-to-a-max-expression/m-p/174345#M43204</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks a lot Jürg, you just saved my life ^^ this works perfectly !!!!&lt;/P&gt;&lt;P&gt;It's perfectly working, i firstly thought about the "firstsortedvalue" but i tried using the other option...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BTW, What does the "%" mean in the loading script ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Jun 2010 13:55:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Get-the-dimension-value-associated-to-a-max-expression/m-p/174345#M43204</guid>
      <dc:creator />
      <dc:date>2010-06-08T13:55:10Z</dc:date>
    </item>
  </channel>
</rss>

