<?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 Help with Complex Expression in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Help-with-Complex-Expression/m-p/1228985#M391842</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am struggling to create the following expression to be used in a chart.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a concatenated fact table which consists of Sales (record type 'SA') and First Sales Date (record type 'FS') which consists of a date when the customer had the first sale.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to create an expression where I get the total Sales for the month where the customers had the first Sales.&lt;/P&gt;&lt;P&gt;For ex for April 2016:&lt;BR /&gt;Total Sales in month&amp;nbsp; $15,000&lt;BR /&gt;No of First Customers 230&lt;BR /&gt;Total Sales from first customers $8,500 (therefore Sales from returning customers $6,500)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I wrote the following expression:&lt;BR /&gt;=SUM({&amp;lt;AccountID=P({&amp;lt;Type={'FS'&amp;gt;}) &amp;gt;} Sales)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;however the above will give me the sales of months 5,6,7, etc.. for the customers who came first active in Month 4, and not sales for just month 4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone help me in this please?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to somehow achive the following condition&lt;BR /&gt;=SUM({&amp;lt;AccountID=P({&amp;lt;Type={'FS'}, Month_Number_Year={'4'}&amp;gt;} ), Month_Number_Year={'4'}&amp;gt;} Sales)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many thanks for your help,&lt;/P&gt;&lt;P&gt;Jon&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Jonathan Mallia&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 25 Nov 2016 10:56:01 GMT</pubDate>
    <dc:creator />
    <dc:date>2016-11-25T10:56:01Z</dc:date>
    <item>
      <title>Help with Complex Expression</title>
      <link>https://community.qlik.com/t5/QlikView/Help-with-Complex-Expression/m-p/1228985#M391842</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am struggling to create the following expression to be used in a chart.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a concatenated fact table which consists of Sales (record type 'SA') and First Sales Date (record type 'FS') which consists of a date when the customer had the first sale.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to create an expression where I get the total Sales for the month where the customers had the first Sales.&lt;/P&gt;&lt;P&gt;For ex for April 2016:&lt;BR /&gt;Total Sales in month&amp;nbsp; $15,000&lt;BR /&gt;No of First Customers 230&lt;BR /&gt;Total Sales from first customers $8,500 (therefore Sales from returning customers $6,500)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I wrote the following expression:&lt;BR /&gt;=SUM({&amp;lt;AccountID=P({&amp;lt;Type={'FS'&amp;gt;}) &amp;gt;} Sales)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;however the above will give me the sales of months 5,6,7, etc.. for the customers who came first active in Month 4, and not sales for just month 4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone help me in this please?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to somehow achive the following condition&lt;BR /&gt;=SUM({&amp;lt;AccountID=P({&amp;lt;Type={'FS'}, Month_Number_Year={'4'}&amp;gt;} ), Month_Number_Year={'4'}&amp;gt;} Sales)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many thanks for your help,&lt;/P&gt;&lt;P&gt;Jon&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Jonathan Mallia&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Nov 2016 10:56:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-with-Complex-Expression/m-p/1228985#M391842</guid>
      <dc:creator />
      <dc:date>2016-11-25T10:56:01Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Complex Expression</title>
      <link>https://community.qlik.com/t5/QlikView/Help-with-Complex-Expression/m-p/1228986#M391843</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do you get the output right with your last expression, i.e &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;EM&gt;=SUM({&amp;lt;AccountID=P({&amp;lt;Type={'FS'}, Month_Number_Year={'4'}&amp;gt;} ), Month_Number_Year={'4'}&amp;gt;} Sales)&lt;/EM&gt;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt; ?&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you post a sample qvw?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Nov 2016 11:04:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-with-Complex-Expression/m-p/1228986#M391843</guid>
      <dc:creator>tresB</dc:creator>
      <dc:date>2016-11-25T11:04:39Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Complex Expression</title>
      <link>https://community.qlik.com/t5/QlikView/Help-with-Complex-Expression/m-p/1228987#M391844</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes the last expression gives me the correct output because it returns the customers who had type FS in month 4, and Sales of month 4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Nov 2016 11:06:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-with-Complex-Expression/m-p/1228987#M391844</guid>
      <dc:creator />
      <dc:date>2016-11-25T11:06:32Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Complex Expression</title>
      <link>https://community.qlik.com/t5/QlikView/Help-with-Complex-Expression/m-p/1228988#M391845</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So you are probably trying to make it dynamic by setting a formula for '4'. Am I right? If so, please tell your logic in detail how you decide on '4' ? Perhaps a sample qvw with sample data ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Nov 2016 11:08:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-with-Complex-Expression/m-p/1228988#M391845</guid>
      <dc:creator>tresB</dc:creator>
      <dc:date>2016-11-25T11:08:26Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Complex Expression</title>
      <link>https://community.qlik.com/t5/QlikView/Help-with-Complex-Expression/m-p/1228989#M391846</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What I need is something based on&lt;/P&gt;&lt;P&gt;=SUM({&amp;lt;AccountID=P({&amp;lt;Type={'FS'&amp;gt;}) &amp;gt;} Sales)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;to be shown in a chart - a chart which shows the total sales from first time customers. The Dimension on this chart is simply Month.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Nov 2016 11:10:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-with-Complex-Expression/m-p/1228989#M391846</guid>
      <dc:creator />
      <dc:date>2016-11-25T11:10:37Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Complex Expression</title>
      <link>https://community.qlik.com/t5/QlikView/Help-with-Complex-Expression/m-p/1228990#M391847</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Tresesco,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Did you manage to get hold of the sample app?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Nov 2016 12:56:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-with-Complex-Expression/m-p/1228990#M391847</guid>
      <dc:creator />
      <dc:date>2016-11-25T12:56:06Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Complex Expression</title>
      <link>https://community.qlik.com/t5/QlikView/Help-with-Complex-Expression/m-p/1228991#M391848</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;May be looking to get this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/144865_Capture.PNG" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Expression&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;=Sum(Aggr(If(AccountBrandID = Above(AccountBrandID) and Above(Type) = 'FS', Sum(Deposits)), Month_Number_Year, AccountBrandID, Type))&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Nov 2016 13:11:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-with-Complex-Expression/m-p/1228991#M391848</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2016-11-25T13:11:23Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Complex Expression</title>
      <link>https://community.qlik.com/t5/QlikView/Help-with-Complex-Expression/m-p/1228992#M391849</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sunny,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the above. The Value for April should be 25,830 however. The April value in the chart should be the same as when selecting Apr from the top list.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Nov 2016 14:02:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-with-Complex-Expression/m-p/1228992#M391849</guid>
      <dc:creator />
      <dc:date>2016-11-25T14:02:37Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Complex Expression</title>
      <link>https://community.qlik.com/t5/QlikView/Help-with-Complex-Expression/m-p/1228993#M391850</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So after a while it looks like the below works...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Sum&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;BR /&gt; (&lt;BR /&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;Aggr&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;( &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;IF&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;COUNT&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;DISTINCT&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Type&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;) = 2, &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 8pt;"&gt;SUM&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Deposits&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;),0), &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;AccountBrandID&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #800000; font-size: 8pt;"&gt;Month_Name_Abbreviation&lt;/SPAN&gt;&lt;SPAN style="font-size: 8pt;"&gt;)&lt;BR /&gt; ) &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyone can confirm this and ensure it works in all scenarios?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Nov 2016 14:18:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-with-Complex-Expression/m-p/1228993#M391850</guid>
      <dc:creator />
      <dc:date>2016-11-25T14:18:02Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Complex Expression</title>
      <link>https://community.qlik.com/t5/QlikView/Help-with-Complex-Expression/m-p/1228994#M391851</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Both our expressions are giving the same values. Not sure what difference did you find?&lt;/P&gt;&lt;P&gt;&lt;IMG alt="Capture.PNG" class="jive-image image-1" src="https://community.qlik.com/legacyfs/online/144896_Capture.PNG" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;1st expression is mind and second one is yours&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Nov 2016 18:11:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-with-Complex-Expression/m-p/1228994#M391851</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2016-11-25T18:11:36Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Complex Expression</title>
      <link>https://community.qlik.com/t5/QlikView/Help-with-Complex-Expression/m-p/1228995#M391852</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Sunny, Both provide the same result actually. Are the 2 expressions syntactically identical? You recon is there a better or cleaner way to write the expression? Many thanks again, Jon&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Nov 2016 18:25:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-with-Complex-Expression/m-p/1228995#M391852</guid>
      <dc:creator />
      <dc:date>2016-11-25T18:25:43Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Complex Expression</title>
      <link>https://community.qlik.com/t5/QlikView/Help-with-Complex-Expression/m-p/1228996#M391853</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think the two expressions are different ways to reach same result but can vary based on your actual data. In your case if both the expressions are working, I would suggest you to use your own expression as it is simpler and require a smaller aggregation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HTH&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;Sunny&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Nov 2016 18:49:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-with-Complex-Expression/m-p/1228996#M391853</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2016-11-25T18:49:12Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Complex Expression</title>
      <link>https://community.qlik.com/t5/QlikView/Help-with-Complex-Expression/m-p/2030086#M1222349</link>
      <description>&lt;P&gt;You can use the following set expression to calculate the total sales for the month where customers had their first sale:&lt;/P&gt;
&lt;P&gt;Sum({$&amp;lt;[First Sales Date.autoCalendar.Month]={"$(=Month([First Sales Date]))"}&amp;gt;} Sales)&lt;/P&gt;
&lt;P&gt;This expression uses the "Sum" function to sum the sales for the selected month, specified by the First Sales Date field. The "First Sales Date.autoCalendar.Month" field is used to filter the data to the month of the first sale. The "Month" function is used to extract the month from the First Sales Date field.&lt;/P&gt;
&lt;P&gt;To calculate the number of first customers, you can use the following expression:&lt;/P&gt;
&lt;P&gt;CountD(Distinct {$&amp;lt;[First Sales Date.autoCalendar.Month]={"$(=Month([First Sales Date]))"}&amp;gt;} [Customer ID])&lt;/P&gt;
&lt;P&gt;This expression uses the "CountD" function to count the number of distinct customer IDs in the selected month, specified by the First Sales Date field.&lt;/P&gt;
&lt;P&gt;You can use these expressions in a chart, and then subtract the Total Sales from first customers from the Total Sales in the month to get the Sales from returning customers.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Jan 2023 20:45:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Help-with-Complex-Expression/m-p/2030086#M1222349</guid>
      <dc:creator>jcmachado</dc:creator>
      <dc:date>2023-01-25T20:45:26Z</dc:date>
    </item>
  </channel>
</rss>

