<?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 Common date filter referring two different date in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Common-date-filter-referring-two-different-date/m-p/2484341#M101145</link>
    <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;I want to create a report with MonthYear as dimension but KPI referring to two different date. I have existing data model with OrderDate &amp;amp; ShippingDate where calendar is linked to OrderDate. Below is the sample dataset&lt;/P&gt;
&lt;TABLE width="258"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="87"&gt;OrderID&lt;/TD&gt;
&lt;TD width="84"&gt;OrderDate&lt;/TD&gt;
&lt;TD width="87"&gt;ShipDate&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;15/01/2024&lt;/TD&gt;
&lt;TD&gt;19/01/2024&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;TD&gt;19/01/2024&lt;/TD&gt;
&lt;TD&gt;20/01/2024&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;3&lt;/TD&gt;
&lt;TD&gt;20/01/2024&lt;/TD&gt;
&lt;TD&gt;02/02/2024&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;4&lt;/TD&gt;
&lt;TD&gt;10/02/2024&lt;/TD&gt;
&lt;TD&gt;12/02/2024&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;5&lt;/TD&gt;
&lt;TD&gt;15/03/2024&lt;/TD&gt;
&lt;TD&gt;18/03/2024&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Below is the required output&lt;/P&gt;
&lt;TABLE width="326"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="87"&gt;MonthYear&lt;/TD&gt;
&lt;TD width="111"&gt;Count of Orders&lt;/TD&gt;
&lt;TD width="128"&gt;Count of Shipment&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;Jan-24&lt;/TD&gt;
&lt;TD&gt;3&lt;/TD&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;Feb-24&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;Mar-24&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would create Canonical date in my model to handle this scenario, but issue is that I am not allowed to change the model due to critical app. Hence, I would like to somehow manage it through chart expression. Is it achievable using chart expression?&lt;/P&gt;</description>
    <pubDate>Mon, 30 Sep 2024 11:51:11 GMT</pubDate>
    <dc:creator>rob_vander</dc:creator>
    <dc:date>2024-09-30T11:51:11Z</dc:date>
    <item>
      <title>Common date filter referring two different date</title>
      <link>https://community.qlik.com/t5/App-Development/Common-date-filter-referring-two-different-date/m-p/2484341#M101145</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;I want to create a report with MonthYear as dimension but KPI referring to two different date. I have existing data model with OrderDate &amp;amp; ShippingDate where calendar is linked to OrderDate. Below is the sample dataset&lt;/P&gt;
&lt;TABLE width="258"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="87"&gt;OrderID&lt;/TD&gt;
&lt;TD width="84"&gt;OrderDate&lt;/TD&gt;
&lt;TD width="87"&gt;ShipDate&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;15/01/2024&lt;/TD&gt;
&lt;TD&gt;19/01/2024&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;TD&gt;19/01/2024&lt;/TD&gt;
&lt;TD&gt;20/01/2024&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;3&lt;/TD&gt;
&lt;TD&gt;20/01/2024&lt;/TD&gt;
&lt;TD&gt;02/02/2024&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;4&lt;/TD&gt;
&lt;TD&gt;10/02/2024&lt;/TD&gt;
&lt;TD&gt;12/02/2024&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;5&lt;/TD&gt;
&lt;TD&gt;15/03/2024&lt;/TD&gt;
&lt;TD&gt;18/03/2024&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Below is the required output&lt;/P&gt;
&lt;TABLE width="326"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="87"&gt;MonthYear&lt;/TD&gt;
&lt;TD width="111"&gt;Count of Orders&lt;/TD&gt;
&lt;TD width="128"&gt;Count of Shipment&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;Jan-24&lt;/TD&gt;
&lt;TD&gt;3&lt;/TD&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;Feb-24&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;Mar-24&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;TD&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would create Canonical date in my model to handle this scenario, but issue is that I am not allowed to change the model due to critical app. Hence, I would like to somehow manage it through chart expression. Is it achievable using chart expression?&lt;/P&gt;</description>
      <pubDate>Mon, 30 Sep 2024 11:51:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Common-date-filter-referring-two-different-date/m-p/2484341#M101145</guid>
      <dc:creator>rob_vander</dc:creator>
      <dc:date>2024-09-30T11:51:11Z</dc:date>
    </item>
    <item>
      <title>Re: Common date filter referring two different date</title>
      <link>https://community.qlik.com/t5/App-Development/Common-date-filter-referring-two-different-date/m-p/2484348#M101146</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/225019"&gt;@rob_vander&lt;/a&gt;&amp;nbsp; which Qlik sense version are you on?&lt;/P&gt;</description>
      <pubDate>Mon, 30 Sep 2024 12:18:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Common-date-filter-referring-two-different-date/m-p/2484348#M101146</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2024-09-30T12:18:02Z</dc:date>
    </item>
    <item>
      <title>Re: Common date filter referring two different date</title>
      <link>https://community.qlik.com/t5/App-Development/Common-date-filter-referring-two-different-date/m-p/2484362#M101147</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/336"&gt;@Kushal_Chawda&lt;/a&gt;&amp;nbsp; It's Nov 2023&lt;/P&gt;</description>
      <pubDate>Mon, 30 Sep 2024 12:56:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Common-date-filter-referring-two-different-date/m-p/2484362#M101147</guid>
      <dc:creator>rob_vander</dc:creator>
      <dc:date>2024-09-30T12:56:06Z</dc:date>
    </item>
    <item>
      <title>Re: Common date filter referring two different date</title>
      <link>https://community.qlik.com/t5/App-Development/Common-date-filter-referring-two-different-date/m-p/2484405#M101148</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/225019"&gt;@rob_vander&lt;/a&gt;&amp;nbsp; Assuming that your MonthYear field is numeric field created either using date(monthstart(&lt;SPAN&gt;OrderDate&lt;/SPAN&gt;),'MMM YYYY')&amp;nbsp; or monthname(&lt;SPAN&gt;OrderDate&lt;/SPAN&gt;).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can utilise &lt;STRONG&gt;chart level scripting&amp;nbsp;&lt;/STRONG&gt;feature of Qlik. You need to enable chart scripting option &lt;A href="https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartLevelScripting/enable-chart-level-scripting.htm#:~:text=Do%20the%20following%3A%20In%20your%20app%2C%20click%20the,app%20details%20area%2C%20click.%20Turn%20on%20Chart%20scripting" target="_self"&gt;here&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Once char scripting option is enable create table with Dimension Month and below two measures&lt;/P&gt;
&lt;P&gt;1) Count(distinct OrderID)&lt;/P&gt;
&lt;P&gt;2) Sum(0)&lt;/P&gt;
&lt;P&gt;In Scripts section of table, add below script&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;//Gets the total no of rows in the current Chart or Table

Let r = HCNoRows();

//Looping through the rows to generate the Count

For i = 1 to r

//Picks the value of the Month dimension to create monthstart (vMaxDate) and monthend(vMaxDate)  date and store it in variables

   Let vMinDate = monthstart(HCValue(#hc1.dimension.1, i));
   Let vMaxDate = monthend(HCValue(#hc1.dimension.1, i));

// Using above variable calculate measure referencing Ship date and store the value in vQuantityDelivered variable

   Let vCountShipment = $(=count({&amp;lt;ShipDate={"&amp;gt;=$(vMinDate)&amp;lt;=$(vMaxDate)"}&amp;gt;} distinct OrderID));

 //Pushing the computed value to the Count of Shipments measure 

   Put #hc1.measure.2(i) = $(vCountShipment);
   
next
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2024-09-30 at 16.11.46.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/172339i143E8F313A733E99/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screenshot 2024-09-30 at 16.11.46.png" alt="Screenshot 2024-09-30 at 16.11.46.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Sep 2024 15:13:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Common-date-filter-referring-two-different-date/m-p/2484405#M101148</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2024-09-30T15:13:03Z</dc:date>
    </item>
    <item>
      <title>Re: Common date filter referring two different date</title>
      <link>https://community.qlik.com/t5/App-Development/Common-date-filter-referring-two-different-date/m-p/2484407#M101149</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/336"&gt;@Kushal_Chawda&lt;/a&gt;&amp;nbsp; This is good option. I never tried chart level scripting before. Is it safe to use?&amp;nbsp; But one thing I noticed is chart total shows 0 for Count of shipment. Do you know how to fix it?&lt;/P&gt;</description>
      <pubDate>Mon, 30 Sep 2024 15:40:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Common-date-filter-referring-two-different-date/m-p/2484407#M101149</guid>
      <dc:creator>rob_vander</dc:creator>
      <dc:date>2024-09-30T15:40:24Z</dc:date>
    </item>
    <item>
      <title>Re: Common date filter referring two different date</title>
      <link>https://community.qlik.com/t5/App-Development/Common-date-filter-referring-two-different-date/m-p/2484413#M101150</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/225019"&gt;@rob_vander&lt;/a&gt;&amp;nbsp; It seems some limitation of this feature. May be&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/12989"&gt;@Michael_Tarallo&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/24514"&gt;@Patric_Nordstrom&lt;/a&gt;&amp;nbsp;can highlight further if it is known issue.&lt;/P&gt;
&lt;P&gt;But there is a workaround. Create variable &lt;STRONG&gt;vCountShipmentTotal&lt;/STRONG&gt; below on frond end&lt;/P&gt;
&lt;P&gt;&lt;FONT face="comic sans ms,sans-serif"&gt;=count({&amp;lt;ShipDate={"&amp;gt;=$(=monthstart(min(OrderDate)))&amp;lt;=$(=monthend(max(OrderDate)))"}&amp;gt;} distinct OrderID)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Now, Instead of sum(0) expression, call&amp;nbsp;&lt;STRONG&gt;vCountShipmentTotal&lt;/STRONG&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;variable in second measure&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Note:&amp;nbsp;&lt;/STRONG&gt;Make sure that variable name is different than used in chart Script&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2024-09-30 at 16.59.42.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/172343iCF4FB809FF2CDAB1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screenshot 2024-09-30 at 16.59.42.png" alt="Screenshot 2024-09-30 at 16.59.42.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Sep 2024 16:00:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Common-date-filter-referring-two-different-date/m-p/2484413#M101150</guid>
      <dc:creator>Kushal_Chawda</dc:creator>
      <dc:date>2024-09-30T16:00:09Z</dc:date>
    </item>
  </channel>
</rss>

