<?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 Counting number of weeks between two date fields which are not from the same year in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Counting-number-of-weeks-between-two-date-fields-which-are-not/m-p/1590613#M443540</link>
    <description>&lt;P&gt;Hello Qlik COmmunity&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have two date field formatted this way 'DD/MM/YYYY'&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Comparaison Date.png" style="width: 193px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/13567i3088CEAD6AE8DEF2/image-size/large?v=v2&amp;amp;px=999" role="button" title="Comparaison Date.png" alt="Comparaison Date.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to count the number of weeks between this twho dates knowing that date 1 is YYYY and date 2 is YYYY + n&lt;/P&gt;&lt;P&gt;I use this formula in the expression:&lt;/P&gt;&lt;P&gt;=if(Num(Year([Delivery])) = Num(Year([Schedule])),&lt;BR /&gt;Num(Week([Delivery])) - Num(Week([Schedule])),&lt;BR /&gt;if(Num(Year([Delivery])) &amp;gt; Num(Year([Schedule])),&lt;BR /&gt;52 - Num(Week([Schedule])) + Num(Week([Delivery]))))&lt;/P&gt;&lt;P&gt;The formula is working but the issue is the number 52. It represents the number of week in a year.&lt;/P&gt;&lt;P&gt;But the issue is i d'like to turn this into an expression or variable which tell for each year the number of weeks.&lt;/P&gt;&lt;P&gt;Besides the issue with my formula is that it works only if the date fields are only a year appart.&lt;/P&gt;&lt;P&gt;Thanks for the help&lt;/P&gt;</description>
    <pubDate>Sat, 16 Nov 2024 20:41:24 GMT</pubDate>
    <dc:creator>lessassy</dc:creator>
    <dc:date>2024-11-16T20:41:24Z</dc:date>
    <item>
      <title>Counting number of weeks between two date fields which are not from the same year</title>
      <link>https://community.qlik.com/t5/QlikView/Counting-number-of-weeks-between-two-date-fields-which-are-not/m-p/1590613#M443540</link>
      <description>&lt;P&gt;Hello Qlik COmmunity&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have two date field formatted this way 'DD/MM/YYYY'&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Comparaison Date.png" style="width: 193px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/13567i3088CEAD6AE8DEF2/image-size/large?v=v2&amp;amp;px=999" role="button" title="Comparaison Date.png" alt="Comparaison Date.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to count the number of weeks between this twho dates knowing that date 1 is YYYY and date 2 is YYYY + n&lt;/P&gt;&lt;P&gt;I use this formula in the expression:&lt;/P&gt;&lt;P&gt;=if(Num(Year([Delivery])) = Num(Year([Schedule])),&lt;BR /&gt;Num(Week([Delivery])) - Num(Week([Schedule])),&lt;BR /&gt;if(Num(Year([Delivery])) &amp;gt; Num(Year([Schedule])),&lt;BR /&gt;52 - Num(Week([Schedule])) + Num(Week([Delivery]))))&lt;/P&gt;&lt;P&gt;The formula is working but the issue is the number 52. It represents the number of week in a year.&lt;/P&gt;&lt;P&gt;But the issue is i d'like to turn this into an expression or variable which tell for each year the number of weeks.&lt;/P&gt;&lt;P&gt;Besides the issue with my formula is that it works only if the date fields are only a year appart.&lt;/P&gt;&lt;P&gt;Thanks for the help&lt;/P&gt;</description>
      <pubDate>Sat, 16 Nov 2024 20:41:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Counting-number-of-weeks-between-two-date-fields-which-are-not/m-p/1590613#M443540</guid>
      <dc:creator>lessassy</dc:creator>
      <dc:date>2024-11-16T20:41:24Z</dc:date>
    </item>
    <item>
      <title>Re: Counting number of weeks between two date fields which are not from the same year</title>
      <link>https://community.qlik.com/t5/QlikView/Counting-number-of-weeks-between-two-date-fields-which-are-not/m-p/1590990#M443561</link>
      <description>&lt;P&gt;I think you could use a quite simple approach like:&lt;/P&gt;&lt;P&gt;floor((date1 - date2) / 7)&lt;/P&gt;&lt;P&gt;and another method might be:&lt;/P&gt;&lt;P&gt;(year(date1) * 52 + week(date1)) - (year(date2) * 52 + week(date2))&lt;/P&gt;&lt;P&gt;Depending to your expected results you might need a few additionally measurements to adjust the rounding-direction or to handle the week 53 and/or shift-years or something similar.&lt;/P&gt;&lt;P&gt;- Marcus&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2019 12:34:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Counting-number-of-weeks-between-two-date-fields-which-are-not/m-p/1590990#M443561</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2019-06-12T12:34:12Z</dc:date>
    </item>
  </channel>
</rss>

