<?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 Period on Period comparison in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Period-on-Period-comparison/m-p/2531466#M107991</link>
    <description>&lt;DIV class=""&gt;I am trying to create a period to period comparison in a Button chart.&lt;BR /&gt;&lt;BR /&gt;Below is the sample code:&lt;BR /&gt;=&lt;BR /&gt;//arrow&lt;BR /&gt;if(&lt;BR /&gt;(&lt;BR /&gt;(count({&amp;lt;MonthYear={'$(vMaxMonthYear)'}&amp;gt;}distinct id))&lt;BR /&gt;-&lt;BR /&gt;(count({&amp;lt;MonthYear={'$(vPreviousMaxMonth)'}&amp;gt;}distinct id))&lt;BR /&gt;)&amp;gt;=0&lt;BR /&gt;,&lt;BR /&gt;'▲','▼')&lt;BR /&gt;&lt;BR /&gt;&amp;amp;&lt;BR /&gt;&lt;BR /&gt;//Delta&lt;BR /&gt;num((count({&amp;lt;MonthYear={'$(vMaxMonthYear)'}&amp;gt;}distinct id))&lt;BR /&gt;-&lt;BR /&gt;(count({&amp;lt;MonthYear={'$(vPreviousMaxMonth)'}&amp;gt;}distinct id)),'#,##0')&lt;BR /&gt;&amp;amp;&lt;BR /&gt;' vs last month ('&lt;BR /&gt;&amp;amp;&lt;BR /&gt;//last month&lt;BR /&gt;num((count({&amp;lt;MonthYear={'$(vPreviousMaxMonth)'}&amp;gt;}distinct id)),'#,##0')&lt;BR /&gt;&amp;amp;&lt;BR /&gt;')'&lt;BR /&gt;&lt;BR /&gt;However, instead of restricting it to a month on month, I want to change it to a period by period. In other words, when a user chooses 30 days in the filter, I want to dynamically compute the value for the previous period (30 days).&lt;BR /&gt;&lt;BR /&gt;I have create 4 variable:&lt;BR /&gt;1. vStart - variable for start date of selection&lt;BR /&gt;2. vEnd - variable for end date of selection&lt;BR /&gt;3. vPStart - variable for previous period start date (vStart - count(date))&lt;BR /&gt;4. vPEnd - variable for previous period end date (vEnd - count(date))&lt;BR /&gt;&lt;BR /&gt;This: =Count(DISTINCT {$&amp;lt;[Date] = {"&amp;gt;=$(vStart) &amp;lt;=$(vEnd)"}&amp;gt;} id) is working but when I do =Count(DISTINCT {$&amp;lt;[Date] ={"&amp;gt;=$(vPStart) &amp;lt;=$(vPEnd)"}&amp;gt;} id) it returns "0".&lt;BR /&gt;&lt;BR /&gt;I am also guess its a filtering issue where when a user filters for 1 specific month, the data of the previous month is filter off, thus the 0 count. However, how is it that :count({&amp;lt;MonthYear={'$(vPreviousMaxMonth)'}&amp;gt;}distinct id) still works?&lt;/DIV&gt;</description>
    <pubDate>Mon, 22 Sep 2025 06:39:14 GMT</pubDate>
    <dc:creator>Poh</dc:creator>
    <dc:date>2025-09-22T06:39:14Z</dc:date>
    <item>
      <title>Period on Period comparison</title>
      <link>https://community.qlik.com/t5/App-Development/Period-on-Period-comparison/m-p/2531466#M107991</link>
      <description>&lt;DIV class=""&gt;I am trying to create a period to period comparison in a Button chart.&lt;BR /&gt;&lt;BR /&gt;Below is the sample code:&lt;BR /&gt;=&lt;BR /&gt;//arrow&lt;BR /&gt;if(&lt;BR /&gt;(&lt;BR /&gt;(count({&amp;lt;MonthYear={'$(vMaxMonthYear)'}&amp;gt;}distinct id))&lt;BR /&gt;-&lt;BR /&gt;(count({&amp;lt;MonthYear={'$(vPreviousMaxMonth)'}&amp;gt;}distinct id))&lt;BR /&gt;)&amp;gt;=0&lt;BR /&gt;,&lt;BR /&gt;'▲','▼')&lt;BR /&gt;&lt;BR /&gt;&amp;amp;&lt;BR /&gt;&lt;BR /&gt;//Delta&lt;BR /&gt;num((count({&amp;lt;MonthYear={'$(vMaxMonthYear)'}&amp;gt;}distinct id))&lt;BR /&gt;-&lt;BR /&gt;(count({&amp;lt;MonthYear={'$(vPreviousMaxMonth)'}&amp;gt;}distinct id)),'#,##0')&lt;BR /&gt;&amp;amp;&lt;BR /&gt;' vs last month ('&lt;BR /&gt;&amp;amp;&lt;BR /&gt;//last month&lt;BR /&gt;num((count({&amp;lt;MonthYear={'$(vPreviousMaxMonth)'}&amp;gt;}distinct id)),'#,##0')&lt;BR /&gt;&amp;amp;&lt;BR /&gt;')'&lt;BR /&gt;&lt;BR /&gt;However, instead of restricting it to a month on month, I want to change it to a period by period. In other words, when a user chooses 30 days in the filter, I want to dynamically compute the value for the previous period (30 days).&lt;BR /&gt;&lt;BR /&gt;I have create 4 variable:&lt;BR /&gt;1. vStart - variable for start date of selection&lt;BR /&gt;2. vEnd - variable for end date of selection&lt;BR /&gt;3. vPStart - variable for previous period start date (vStart - count(date))&lt;BR /&gt;4. vPEnd - variable for previous period end date (vEnd - count(date))&lt;BR /&gt;&lt;BR /&gt;This: =Count(DISTINCT {$&amp;lt;[Date] = {"&amp;gt;=$(vStart) &amp;lt;=$(vEnd)"}&amp;gt;} id) is working but when I do =Count(DISTINCT {$&amp;lt;[Date] ={"&amp;gt;=$(vPStart) &amp;lt;=$(vPEnd)"}&amp;gt;} id) it returns "0".&lt;BR /&gt;&lt;BR /&gt;I am also guess its a filtering issue where when a user filters for 1 specific month, the data of the previous month is filter off, thus the 0 count. However, how is it that :count({&amp;lt;MonthYear={'$(vPreviousMaxMonth)'}&amp;gt;}distinct id) still works?&lt;/DIV&gt;</description>
      <pubDate>Mon, 22 Sep 2025 06:39:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Period-on-Period-comparison/m-p/2531466#M107991</guid>
      <dc:creator>Poh</dc:creator>
      <dc:date>2025-09-22T06:39:14Z</dc:date>
    </item>
    <item>
      <title>Re: Period on Period comparison</title>
      <link>https://community.qlik.com/t5/App-Development/Period-on-Period-comparison/m-p/2531628#M108020</link>
      <description>&lt;P&gt;What is count(date) here?&amp;nbsp;&lt;BR /&gt;3. vPStart - variable for previous period start date (vStart - count(date))&lt;BR /&gt;4. vPEnd - variable for previous period end date (vEnd - count(date))&lt;BR /&gt;&lt;BR /&gt;you can try just putting $(vPStart) and $(vPEnd) in a separate textbox just to see what values are being evaluated for those variables.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Sep 2025 15:01:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Period-on-Period-comparison/m-p/2531628#M108020</guid>
      <dc:creator>hardikpatel172</dc:creator>
      <dc:date>2025-09-23T15:01:03Z</dc:date>
    </item>
    <item>
      <title>Re: Period on Period comparison</title>
      <link>https://community.qlik.com/t5/App-Development/Period-on-Period-comparison/m-p/2531657#M108027</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I was thinking count(date) will count the number of days between the start and end (when a filter is applied).&amp;nbsp;&lt;/P&gt;&lt;P&gt;With regards to your suggestion, I have split it up to 2 separate text bos but it doesnt seem to be working.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Sep 2025 01:41:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Period-on-Period-comparison/m-p/2531657#M108027</guid>
      <dc:creator>Poh</dc:creator>
      <dc:date>2025-09-24T01:41:25Z</dc:date>
    </item>
    <item>
      <title>Re: Period on Period comparison</title>
      <link>https://community.qlik.com/t5/App-Development/Period-on-Period-comparison/m-p/2531833#M108054</link>
      <description>&lt;P&gt;What I was suggesting is steps to troubleshoot and I will suggest that first get those two variable working PStart and PEnd and I still didn't understand how exactly you want those?&amp;nbsp;&lt;BR /&gt;First, try to decide what values are expecting for PStart and PEnd and how will you calculate those manually based on your selection? That would make things easier for you to define the logic for those variables.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Feel free to share a script or screenshot of how you want and I'll be happy to help!&lt;/P&gt;</description>
      <pubDate>Thu, 25 Sep 2025 12:41:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Period-on-Period-comparison/m-p/2531833#M108054</guid>
      <dc:creator>hardikpatel172</dc:creator>
      <dc:date>2025-09-25T12:41:22Z</dc:date>
    </item>
  </channel>
</rss>

