<?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 same store with a twist - need help in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/same-store-with-a-twist-need-help/m-p/279173#M103908</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Michael,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the push&lt;/P&gt;&lt;P&gt;I have tried using it "as is" initially. I only added a "sum" between the "aggr" and the "if", like this:&lt;/P&gt;&lt;P&gt;sum(aggr(sum(if(OpenDate&amp;lt;=min(Date) and closeDate&amp;gt;=max(Date), Sales)),StoreCode))&lt;/P&gt;&lt;P&gt;but it always returned null or zero values.&lt;/P&gt;&lt;P&gt;after trying various options to no avail,&lt;/P&gt;&lt;P&gt;I tried rethinking about the idea behind it.&lt;/P&gt;&lt;P&gt;at first glance the logic of it seems to make sense, but then i realized something&lt;/P&gt;&lt;P&gt;I am not sure I can exactly explain it but ill try with an example&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;lets say I have 2 store&lt;/P&gt;&lt;P&gt;store 1 was opened in January 2010 and closed on&amp;nbsp; December 2011&lt;/P&gt;&lt;P&gt;store 2 was opened in August 2010 and closed on&amp;nbsp; December 2011&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now if I select months July, August, September&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;with your idea (however eventually implemented) the sales of store 1 would not be included&lt;/P&gt;&lt;P&gt;while store 2 will have its entire sales included.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;what I need is that sales for store 1 will be included but only of the months that the store was opened both in 2010 and 2011&lt;/P&gt;&lt;P&gt;meaning August, September&lt;/P&gt;&lt;P&gt;store 2 will still have its entire sales included.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope I made myself clearer this time &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and also maybe you have an idea why the suggest expression didnt work&lt;/P&gt;&lt;P&gt;Thanks anyway,&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 18 Feb 2012 19:15:16 GMT</pubDate>
    <dc:creator>wizardo</dc:creator>
    <dc:date>2012-02-18T19:15:16Z</dc:date>
    <item>
      <title>same store with a twist - need help</title>
      <link>https://community.qlik.com/t5/QlikView/same-store-with-a-twist-need-help/m-p/279171#M103906</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 need to create a way of showing samestore sales comparison in a specific way.&lt;/P&gt;&lt;P&gt;I have tried many approaches and seen few examples in the forum.&lt;/P&gt;&lt;P&gt;unfortunately it seems my case has a twist not present in any of the places I looked.&lt;/P&gt;&lt;P&gt;hope some of you will be able to give me a push in a direction (any direction lol)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;here goes:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;there are two tables. &lt;/P&gt;&lt;P&gt;stores: holds for each "StoreCode" its "openDate" and "CloseDate"&lt;/P&gt;&lt;P&gt;transactions: holds the rows of sales for each "StoreCode" for each "SaleDate" with a link on "StoreCode"&lt;/P&gt;&lt;P&gt;a chart/str8table is needed&lt;/P&gt;&lt;P&gt;the users should be able to select 2 or more years.&lt;/P&gt;&lt;P&gt;they can also limit months and days of month.&lt;/P&gt;&lt;P&gt;the object should show the sales per each year accroding to the date range&lt;/P&gt;&lt;P&gt;so far its simple....&lt;/P&gt;&lt;P&gt;but it should only include Transaction for&amp;nbsp; specific store for a specific day if&amp;nbsp; &lt;/P&gt;&lt;P&gt;that store was opened at that same date in each of the currently selected years.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so if i select years 2007,2008,2009&lt;/P&gt;&lt;P&gt;and i select the date: may-22&lt;/P&gt;&lt;P&gt;i want to have transaction for a specific store only if it was Opened(active) on this date in all of the 3 selected years&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so if a store was first open on may/23/2007 and was closed in 2010 then it should not be included&lt;/P&gt;&lt;P&gt;because it was opened on may/22/2009&amp;nbsp; and may/22/2008 but not on may/22/2007&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;also if the store was open on may/21/2007 but was closed on may/21/2009 it should not be included&lt;/P&gt;&lt;P&gt;because it was opened on may/22/2007&amp;nbsp; and may/22/2008 but not on may/22/2009&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;eventuely i would like to show it in a line chart with a line per year and month/week/day at the button exis&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As I said have tried many things&lt;/P&gt;&lt;P&gt;but struck DeadEnd at each&lt;/P&gt;&lt;P&gt;hope some of you may help so i will not end up the same &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Feb 2012 00:47:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/same-store-with-a-twist-need-help/m-p/279171#M103906</guid>
      <dc:creator>wizardo</dc:creator>
      <dc:date>2012-02-14T00:47:31Z</dc:date>
    </item>
    <item>
      <title>same store with a twist - need help</title>
      <link>https://community.qlik.com/t5/QlikView/same-store-with-a-twist-need-help/m-p/279172#M103907</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Daniel,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The idea is that for each store (hence aggr by StoreCode below) use its sales if the store was open earlier than the earliest date in selection, and closed later than latest date in selection.&amp;nbsp; So, it maybe something in this direction:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum(aggr(if(OpenDate&amp;lt;=min(Date) and closeDate&amp;gt;=max(Date), Sales),StoreCode))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can be implemented in set analysis as well, but it's not essential.&amp;nbsp; I did not test, so just cosider it as a "push in any direction". &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Michael&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Feb 2012 02:18:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/same-store-with-a-twist-need-help/m-p/279172#M103907</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-02-14T02:18:43Z</dc:date>
    </item>
    <item>
      <title>same store with a twist - need help</title>
      <link>https://community.qlik.com/t5/QlikView/same-store-with-a-twist-need-help/m-p/279173#M103908</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Michael,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the push&lt;/P&gt;&lt;P&gt;I have tried using it "as is" initially. I only added a "sum" between the "aggr" and the "if", like this:&lt;/P&gt;&lt;P&gt;sum(aggr(sum(if(OpenDate&amp;lt;=min(Date) and closeDate&amp;gt;=max(Date), Sales)),StoreCode))&lt;/P&gt;&lt;P&gt;but it always returned null or zero values.&lt;/P&gt;&lt;P&gt;after trying various options to no avail,&lt;/P&gt;&lt;P&gt;I tried rethinking about the idea behind it.&lt;/P&gt;&lt;P&gt;at first glance the logic of it seems to make sense, but then i realized something&lt;/P&gt;&lt;P&gt;I am not sure I can exactly explain it but ill try with an example&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;lets say I have 2 store&lt;/P&gt;&lt;P&gt;store 1 was opened in January 2010 and closed on&amp;nbsp; December 2011&lt;/P&gt;&lt;P&gt;store 2 was opened in August 2010 and closed on&amp;nbsp; December 2011&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now if I select months July, August, September&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;with your idea (however eventually implemented) the sales of store 1 would not be included&lt;/P&gt;&lt;P&gt;while store 2 will have its entire sales included.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;what I need is that sales for store 1 will be included but only of the months that the store was opened both in 2010 and 2011&lt;/P&gt;&lt;P&gt;meaning August, September&lt;/P&gt;&lt;P&gt;store 2 will still have its entire sales included.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope I made myself clearer this time &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and also maybe you have an idea why the suggest expression didnt work&lt;/P&gt;&lt;P&gt;Thanks anyway,&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 18 Feb 2012 19:15:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/same-store-with-a-twist-need-help/m-p/279173#M103908</guid>
      <dc:creator>wizardo</dc:creator>
      <dc:date>2012-02-18T19:15:16Z</dc:date>
    </item>
    <item>
      <title>Re: same store with a twist - need help</title>
      <link>https://community.qlik.com/t5/QlikView/same-store-with-a-twist-need-help/m-p/279174#M103909</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Daniel,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;how is the Date used in your expression linked to SaleDate of your transaction table? Are you using a master calendar?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And if you select months July, August, September, do you also select on year? If not, min(Date) may be dependent on the total year range you keep in your date (calendar?) table, so possibly much earlier than your 2010/2011 store dates of store 1 and store 2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If possible, could you post a small sample?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Stefan&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;edit:&lt;/P&gt;&lt;P&gt;Just reread your post:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;wizardo wrote:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have tried using it "as is" initially. I only added a "sum" between the "aggr" and the "if", like this:&lt;/P&gt;&lt;P&gt;sum(aggr(sum(if(OpenDate&amp;lt;=min(Date) and closeDate&amp;gt;=max(Date), Sales)),StoreCode))&lt;/P&gt;&lt;P&gt;but it always returned null or zero values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;That expression will not work, because you are embedding an aggregation function into another (min() function into sum() ), which is not allowed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think the original expression will not work, because the condition, if met, will return multiple Sales values per StoreCode, so the y-value of the aggr() needs to be unambiguous per dimension value (probably that's why you tried with the additional sum() ?).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What could work&amp;nbsp; is either&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;=sum(aggr( if(OpenDate&amp;lt;=min(total&amp;lt;StoreCode&amp;gt; SaleDate) and CloseDate&amp;gt;=max(total&amp;lt;StoreCode&amp;gt; SaleDate), Sale),StoreCode,SaleDate))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;=sum({&amp;lt;OpenDate= {"&amp;lt;=$(=min(SaleDate))"},CloseDate={"&amp;gt;=$(=max(SaleDate))"}&amp;gt;} Sale)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 18 Feb 2012 21:00:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/same-store-with-a-twist-need-help/m-p/279174#M103909</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2012-02-18T21:00:56Z</dc:date>
    </item>
    <item>
      <title>same store with a twist - need help</title>
      <link>https://community.qlik.com/t5/QlikView/same-store-with-a-twist-need-help/m-p/279175#M103910</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Stefan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You're probably right about the original expression.&amp;nbsp; It is likely should be&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sum(aggr(if(OpenDate&amp;lt;=min(Date) and closeDate&amp;gt;=max(Date), &lt;STRONG&gt;sum&lt;/STRONG&gt;(Sales)),StoreCode))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;BR /&gt;Michael&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 19 Feb 2012 01:18:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/same-store-with-a-twist-need-help/m-p/279175#M103910</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-02-19T01:18:02Z</dc:date>
    </item>
    <item>
      <title>same store with a twist - need help</title>
      <link>https://community.qlik.com/t5/QlikView/same-store-with-a-twist-need-help/m-p/279176#M103911</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Michael,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;yes, that will work if the expression is used in a chart with dimension StoreCode or in a global context.&lt;/P&gt;&lt;P&gt; I've interpreted Daniel's post in a way that he intends to use Time / Date as dimension in his chart, so I believe the aggr() function needs to provide that dimension granularity (SaleDate in my example) as well to allow the containing chart limiting the results to the appropriate dimension values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think the set expression is somewhat more easy to maintain and understand in this scenario, besides the usual suspect 'more performant'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Stefan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 19 Feb 2012 13:05:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/same-store-with-a-twist-need-help/m-p/279176#M103911</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2012-02-19T13:05:57Z</dc:date>
    </item>
  </channel>
</rss>

