<?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: Issues using variables/functions in set analysis in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Issues-using-variables-functions-in-set-analysis/m-p/1568137#M596531</link>
    <description>&lt;P&gt;I don't see the variables in the script? Did you attach the correct file?&lt;/P&gt;</description>
    <pubDate>Thu, 11 Apr 2019 11:24:45 GMT</pubDate>
    <dc:creator>sunny_talwar</dc:creator>
    <dc:date>2019-04-11T11:24:45Z</dc:date>
    <item>
      <title>Issues using variables/functions in set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Issues-using-variables-functions-in-set-analysis/m-p/1567517#M596528</link>
      <description>&lt;P&gt;I am using&amp;nbsp; a pivot table to find the volume of transactions for the current selected period and the previous selected period.&amp;nbsp; Unfortunately my client wants to see both years/months/days as the selected date.&lt;/P&gt;&lt;P&gt;I am using the below formula for selected period&lt;/P&gt;&lt;P&gt;&lt;FONT size="1"&gt;=&lt;/FONT&gt;&lt;FONT color="#0000ff" size="1"&gt;sum&lt;/FONT&gt;&lt;FONT size="1"&gt;({&amp;lt;&lt;/FONT&gt;&lt;FONT color="#800000" size="1"&gt;CalendarDATE&lt;/FONT&gt;&lt;FONT size="1"&gt; = {&lt;/FONT&gt;&lt;FONT color="#800000" size="1"&gt;"&amp;gt;=$(vMinCompareDate) &amp;lt;=$(vMaxCompareDate)"&lt;/FONT&gt;&lt;FONT size="1"&gt;}&amp;gt;}&lt;/FONT&gt;&lt;FONT color="#800000" size="1"&gt;COUNT_TRADE_VOL&lt;/FONT&gt;&lt;FONT size="1"&gt;) &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;I am using the below formula for previous selected period (in this case previous month)&lt;/P&gt;&lt;P&gt;&lt;FONT size="1"&gt;=&lt;/FONT&gt;&lt;FONT color="#0000ff" size="1"&gt;SUM&lt;/FONT&gt;&lt;FONT size="1"&gt;({&amp;lt;&lt;/FONT&gt;&lt;FONT color="#800000" size="1"&gt;CalendarDATE&lt;/FONT&gt;&lt;FONT size="1"&gt;={'&amp;gt;=(Date(vPrevMonthMax))&amp;lt;=$(=Date(vPrevMonthMin))'}&amp;gt;}&lt;/FONT&gt;&lt;FONT color="#800000" size="1"&gt;COUNT_TRADE_VOL&lt;/FONT&gt;&lt;FONT size="1"&gt;) &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;The result is not correct; Both columns are being returned with the same volume.&amp;nbsp; Is any one able to offer any advise please?&lt;/P&gt;&lt;P&gt;Variables:&lt;/P&gt;&lt;P&gt;min compare date &lt;FONT size="3"&gt;=(&lt;/FONT&gt;&lt;FONT color="#0000ff" size="3"&gt;AddYears&lt;/FONT&gt;&lt;FONT size="3"&gt;(&lt;/FONT&gt;&lt;FONT color="#0000ff" size="3"&gt;date&lt;/FONT&gt;&lt;FONT size="3"&gt;(&lt;/FONT&gt;&lt;FONT color="#0000ff" size="3"&gt;Min&lt;/FONT&gt;&lt;FONT size="3"&gt;(&lt;/FONT&gt;&lt;FONT color="#800000" size="3"&gt;CalendarDATE&lt;/FONT&gt;&lt;FONT size="3"&gt;)),0)) &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;Max compare date &lt;/FONT&gt;&lt;FONT size="3"&gt;=(&lt;/FONT&gt;&lt;FONT color="#0000ff" size="3"&gt;AddYears&lt;/FONT&gt;&lt;FONT size="3"&gt;(&lt;/FONT&gt;&lt;FONT color="#0000ff" size="3"&gt;date&lt;/FONT&gt;&lt;FONT size="3"&gt;(&lt;/FONT&gt;&lt;FONT color="#0000ff" size="3"&gt;Max&lt;/FONT&gt;&lt;FONT size="3"&gt;(&lt;/FONT&gt;&lt;FONT color="#800000" size="3"&gt;CalendarDATE&lt;/FONT&gt;&lt;FONT size="3"&gt;)),0)) &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;PrevMonthMin = &lt;/FONT&gt;&lt;FONT size="1"&gt;=&lt;/FONT&gt;&lt;FONT color="#0000ff" size="1"&gt;AddMonths&lt;/FONT&gt;&lt;FONT size="1"&gt;((&lt;/FONT&gt;&lt;STRONG&gt;&lt;I&gt;&lt;FONT color="#808080" size="1"&gt;vMinCompareDate&lt;/FONT&gt;&lt;/I&gt;&lt;/STRONG&gt;&lt;FONT size="1"&gt;),-1) &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;PrevMonthMax = &lt;/FONT&gt;&lt;FONT size="1"&gt;=&lt;/FONT&gt;&lt;FONT color="#0000ff" size="1"&gt;AddMonths&lt;/FONT&gt;&lt;FONT size="1"&gt;((&lt;/FONT&gt;&lt;STRONG&gt;&lt;I&gt;&lt;FONT color="#808080" size="1"&gt;vMaxCompareDate&lt;/FONT&gt;&lt;/I&gt;&lt;/STRONG&gt;&lt;FONT size="1"&gt;),-1) &lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 03:54:00 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Issues-using-variables-functions-in-set-analysis/m-p/1567517#M596528</guid>
      <dc:creator>CM_B</dc:creator>
      <dc:date>2024-11-16T03:54:00Z</dc:date>
    </item>
    <item>
      <title>Re: Issues using variables/functions in set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Issues-using-variables-functions-in-set-analysis/m-p/1567579#M596529</link>
      <description>&lt;P&gt;Would you be able to share a sample to check this out?&lt;/P&gt;</description>
      <pubDate>Wed, 10 Apr 2019 11:40:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Issues-using-variables-functions-in-set-analysis/m-p/1567579#M596529</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2019-04-10T11:40:26Z</dc:date>
    </item>
    <item>
      <title>Re: Issues using variables/functions in set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Issues-using-variables-functions-in-set-analysis/m-p/1568127#M596530</link>
      <description>&lt;P&gt;Thank you for your reply.&amp;nbsp; I have put together a sample- I am using client data so have modified- I am also using a database and have included the data in the simplified example script.&amp;nbsp; The Data and variables are there.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2019 12:30:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Issues-using-variables-functions-in-set-analysis/m-p/1568127#M596530</guid>
      <dc:creator>CM_B</dc:creator>
      <dc:date>2019-04-11T12:30:36Z</dc:date>
    </item>
    <item>
      <title>Re: Issues using variables/functions in set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Issues-using-variables-functions-in-set-analysis/m-p/1568137#M596531</link>
      <description>&lt;P&gt;I don't see the variables in the script? Did you attach the correct file?&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2019 11:24:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Issues-using-variables-functions-in-set-analysis/m-p/1568137#M596531</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2019-04-11T11:24:45Z</dc:date>
    </item>
    <item>
      <title>Re: Issues using variables/functions in set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Issues-using-variables-functions-in-set-analysis/m-p/1568167#M596532</link>
      <description>Should be there now - apologies!</description>
      <pubDate>Thu, 11 Apr 2019 12:15:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Issues-using-variables-functions-in-set-analysis/m-p/1568167#M596532</guid>
      <dc:creator>CM_B</dc:creator>
      <dc:date>2019-04-11T12:15:38Z</dc:date>
    </item>
    <item>
      <title>Re: Issues using variables/functions in set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Issues-using-variables-functions-in-set-analysis/m-p/1568182#M596533</link>
      <description>&lt;P&gt;I assume that your date() creation within the script caused this behaviour and that you need to apply a converting before formatting it. This means doing something like the following:&lt;/P&gt;&lt;P&gt;Date(&lt;STRONG&gt;date#(&lt;/STRONG&gt;CalendarDATE&lt;STRONG&gt;, 'YYYYMMDD')&lt;/STRONG&gt;) as CalendarDATE,&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2019 12:41:08 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Issues-using-variables-functions-in-set-analysis/m-p/1568182#M596533</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2019-04-11T12:41:08Z</dc:date>
    </item>
    <item>
      <title>Re: Issues using variables/functions in set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Issues-using-variables-functions-in-set-analysis/m-p/1569242#M596534</link>
      <description>&lt;P&gt;Thanks &lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/28038"&gt;@marcus_sommer&lt;/a&gt;&amp;nbsp;I have used this format in my data extract script.. would you also recommend using this format within all of the variables?&lt;/P&gt;</description>
      <pubDate>Mon, 15 Apr 2019 08:59:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Issues-using-variables-functions-in-set-analysis/m-p/1569242#M596534</guid>
      <dc:creator>CM_B</dc:creator>
      <dc:date>2019-04-15T08:59:06Z</dc:date>
    </item>
    <item>
      <title>Re: Issues using variables/functions in set analysis</title>
      <link>https://community.qlik.com/t5/QlikView/Issues-using-variables-functions-in-set-analysis/m-p/1569284#M596535</link>
      <description>&lt;P&gt;It's difficult to say. The conversion with date#() in the script is needed because otherwise your data are any number or even a string but no date and none of various date-functions/features would be applicable.&lt;/P&gt;&lt;P&gt;In general it's recommended to use pure numbers - for example created with num() or floor() - if dates need to be calculated and/or matched in any way because the handling with formatted dates could be quite tricky and will always depend from the context in which it should be used. This means the handling of formatted values will always require additionally efforts. Quite often it's useful to have all needed formattings and pure numbers within the master-calendar and then to use the appropriate and further helpful is to create there flags for things like YTD, MTD, LYTD and so on.&lt;/P&gt;&lt;P&gt;In regard to variables - they should simplify the things - and here I'm not sure if they do it in your case. I think I wouldn't use them for what you describe because it will end in nested variables - and probably a lot of them. Of course it will be possible but usually are the efforts for it much higher as the benefits especially if there are other possibilities like the mentioned flags or maybe the use of island-tables.&lt;/P&gt;&lt;P&gt;To get a bit more background take a look here:&amp;nbsp; &lt;A href="https://community.qlik.com/t5/QlikView-Documents/How-to-use-Master-Calendar-and-Date-Values/ta-p/1495741" target="_blank" rel="noopener"&gt;How-to-use-Master-Calendar-and-Date-Values&lt;/A&gt; and here: &lt;A href="https://community.qlik.com/t5/QlikView-Documents/Variables/ta-p/1497368" target="_blank" rel="noopener"&gt;Variables&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;</description>
      <pubDate>Mon, 15 Apr 2019 09:40:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Issues-using-variables-functions-in-set-analysis/m-p/1569284#M596535</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2019-04-15T09:40:15Z</dc:date>
    </item>
  </channel>
</rss>

