<?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: Lien &amp;quot;automatique&amp;quot; calendrier Civil VS calendrier Fiscal in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Lien-quot-automatique-quot-calendrier-Civil-VS-calendrier-Fiscal/m-p/1742562#M453060</link>
    <description>&lt;P&gt;Bonjour &lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/106130"&gt;@DTL&lt;/a&gt; ,&lt;/P&gt;&lt;P&gt;Je te propose de passer par MasterCalendar dans ce cas avec l'ajout de l'année fiscal, c'est plus simple et propre.&lt;/P&gt;&lt;P&gt;voilà un exemple de script:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;Listedate:

load * inline [
ref,Dateref,commentaire
0,01/03/2020,a
1,01/08/2020,b
2,01/09/2020,c
3,25/12/2020,d
4,15/03/2020,e
5,15/04/2020,f
]
;




Temp:

Load

               min(Date#(Dateref,'DD/MM/YYYY')) as minDate,

               max(Date#(Dateref,'DD/MM/YYYY')) as maxDate

Resident Listedate;


LET vStartDate = Num(YearStart(Peek('minDate', 0, 'Temp'), -1));//depuis ta data tu va récuperer le min et max pour construire le mastercalendar

LET vEndDate = Num(YearEnd(Peek('maxDate', 0, 'Temp')));

DROP Table Temp;


SET vFiscalYearStartMonth = 4;

FiscalCalendar:

left join(Listedate)

LOAD

*,

Dual('Q' &amp;amp; Ceil(FiscalMonth/3), Ceil(FiscalMonth/3)) AS FiscalQuarter, // Fiscal Calendar Quarter

Dual(Text(Date(MonthEnd(Dateref), 'MMM')), FiscalMonth) AS FiscalMonthName; // Fiscal Calendar Month Name

LOAD

*,

Year(Dateref) AS Year, // Standard Calendar Year

Month(Dateref) AS Month, // Standard Calendar Month

Date(MonthEnd(Dateref), 'MMM') AS MonthName,  // Standard Calendar Month Name

Dual('Q' &amp;amp; Ceil(Month(Dateref)/3), Ceil(Month(Dateref)/3)) AS Quarter,  // Standard Calendar Quarter

Mod(Month(Dateref) - $(vFiscalYearStartMonth), 12)+1 AS FiscalMonth,  // Fiscal Calendar Month

YearName(Dateref, 0, $(vFiscalYearStartMonth)) AS FiscalYear;  // Fiscal Calendar Year

LOAD

Date($(vStartDate) + RangeSum(Peek('RowNum'), 1) - 1) AS Dateref,

RangeSum(Peek('RowNum'), 1) AS RowNum

AutoGenerate vEndDate - vStartDate + 1;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;pour l'exemple d'entrée, le output est :&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/40320i877CB123ED382260/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;tu peux enlever le left join si tu veux garder le calendrier séparément sinon tu affiche le calendrier fiscal des données d'entrées seulement&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 09 Sep 2020 20:46:50 GMT</pubDate>
    <dc:creator>Taoufiq_Zarra</dc:creator>
    <dc:date>2020-09-09T20:46:50Z</dc:date>
    <item>
      <title>Lien "automatique" calendrier Civil VS calendrier Fiscal</title>
      <link>https://community.qlik.com/t5/QlikView/Lien-quot-automatique-quot-calendrier-Civil-VS-calendrier-Fiscal/m-p/1742503#M453056</link>
      <description>&lt;P&gt;Bonjour&lt;/P&gt;&lt;P&gt;Après le rachat de mon entreprise, le calendrier fiscal est passé du 01/01-31/12 au 01/04-31/03.&lt;/P&gt;&lt;P&gt;Les utilisateurs souhaiteraient pouvoir sélectionner soit sur une année civile, soit sur année fiscale.&lt;/P&gt;&lt;P&gt;Dans l'exemple joint en image, j'ai fait une bête formule avec des IF pour définir dans quel calendrier fiscale se trouve une date donnée. J'ai commencé de regarder aussi avec la fonction InYear.&lt;/P&gt;&lt;P&gt;Cette solution ne me satisfait pas vraiment car limitée dans le temps ou oblige à régulièrement revoir le script pour rajouter des tests 8-(&lt;/P&gt;&lt;P&gt;Des idées pour rendre "générique" une fonction indiquant à quel calendrier fiscal appartient une date donnée ?&lt;/P&gt;&lt;P&gt;Merci d'avance pour vos contributions/idées.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2020 16:07:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Lien-quot-automatique-quot-calendrier-Civil-VS-calendrier-Fiscal/m-p/1742503#M453056</guid>
      <dc:creator>DTL</dc:creator>
      <dc:date>2020-09-09T16:07:24Z</dc:date>
    </item>
    <item>
      <title>Re: Lien "automatique" calendrier Civil VS calendrier Fiscal</title>
      <link>https://community.qlik.com/t5/QlikView/Lien-quot-automatique-quot-calendrier-Civil-VS-calendrier-Fiscal/m-p/1742562#M453060</link>
      <description>&lt;P&gt;Bonjour &lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/106130"&gt;@DTL&lt;/a&gt; ,&lt;/P&gt;&lt;P&gt;Je te propose de passer par MasterCalendar dans ce cas avec l'ajout de l'année fiscal, c'est plus simple et propre.&lt;/P&gt;&lt;P&gt;voilà un exemple de script:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;Listedate:

load * inline [
ref,Dateref,commentaire
0,01/03/2020,a
1,01/08/2020,b
2,01/09/2020,c
3,25/12/2020,d
4,15/03/2020,e
5,15/04/2020,f
]
;




Temp:

Load

               min(Date#(Dateref,'DD/MM/YYYY')) as minDate,

               max(Date#(Dateref,'DD/MM/YYYY')) as maxDate

Resident Listedate;


LET vStartDate = Num(YearStart(Peek('minDate', 0, 'Temp'), -1));//depuis ta data tu va récuperer le min et max pour construire le mastercalendar

LET vEndDate = Num(YearEnd(Peek('maxDate', 0, 'Temp')));

DROP Table Temp;


SET vFiscalYearStartMonth = 4;

FiscalCalendar:

left join(Listedate)

LOAD

*,

Dual('Q' &amp;amp; Ceil(FiscalMonth/3), Ceil(FiscalMonth/3)) AS FiscalQuarter, // Fiscal Calendar Quarter

Dual(Text(Date(MonthEnd(Dateref), 'MMM')), FiscalMonth) AS FiscalMonthName; // Fiscal Calendar Month Name

LOAD

*,

Year(Dateref) AS Year, // Standard Calendar Year

Month(Dateref) AS Month, // Standard Calendar Month

Date(MonthEnd(Dateref), 'MMM') AS MonthName,  // Standard Calendar Month Name

Dual('Q' &amp;amp; Ceil(Month(Dateref)/3), Ceil(Month(Dateref)/3)) AS Quarter,  // Standard Calendar Quarter

Mod(Month(Dateref) - $(vFiscalYearStartMonth), 12)+1 AS FiscalMonth,  // Fiscal Calendar Month

YearName(Dateref, 0, $(vFiscalYearStartMonth)) AS FiscalYear;  // Fiscal Calendar Year

LOAD

Date($(vStartDate) + RangeSum(Peek('RowNum'), 1) - 1) AS Dateref,

RangeSum(Peek('RowNum'), 1) AS RowNum

AutoGenerate vEndDate - vStartDate + 1;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;pour l'exemple d'entrée, le output est :&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/40320i877CB123ED382260/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;tu peux enlever le left join si tu veux garder le calendrier séparément sinon tu affiche le calendrier fiscal des données d'entrées seulement&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2020 20:46:50 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Lien-quot-automatique-quot-calendrier-Civil-VS-calendrier-Fiscal/m-p/1742562#M453060</guid>
      <dc:creator>Taoufiq_Zarra</dc:creator>
      <dc:date>2020-09-09T20:46:50Z</dc:date>
    </item>
    <item>
      <title>Re: Lien "automatique" calendrier Civil VS calendrier Fiscal</title>
      <link>https://community.qlik.com/t5/QlikView/Lien-quot-automatique-quot-calendrier-Civil-VS-calendrier-Fiscal/m-p/1742727#M453062</link>
      <description>&lt;P&gt;Bonjour et merci pour la réactivité&lt;/P&gt;&lt;P&gt;Le champ FiscalYear est exactement ce que je cherchais.&lt;/P&gt;&lt;P&gt;Merci encore&lt;/P&gt;</description>
      <pubDate>Thu, 10 Sep 2020 09:18:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Lien-quot-automatique-quot-calendrier-Civil-VS-calendrier-Fiscal/m-p/1742727#M453062</guid>
      <dc:creator>DTL</dc:creator>
      <dc:date>2020-09-10T09:18:59Z</dc:date>
    </item>
    <item>
      <title>Re: Lien "automatique" calendrier Civil VS calendrier Fiscal</title>
      <link>https://community.qlik.com/t5/QlikView/Lien-quot-automatique-quot-calendrier-Civil-VS-calendrier-Fiscal/m-p/1742728#M453063</link>
      <description>&lt;P&gt;très bien ! bonne chance pour la suite&lt;/P&gt;</description>
      <pubDate>Thu, 10 Sep 2020 09:19:55 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Lien-quot-automatique-quot-calendrier-Civil-VS-calendrier-Fiscal/m-p/1742728#M453063</guid>
      <dc:creator>Taoufiq_Zarra</dc:creator>
      <dc:date>2020-09-10T09:19:55Z</dc:date>
    </item>
  </channel>
</rss>

