<?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: Mark Files with hihgest Date in Connectivity &amp; Data Prep</title>
    <link>https://community.qlik.com/t5/Connectivity-Data-Prep/Mark-Files-with-hihgest-Date/m-p/1886826#M10147</link>
    <description>&lt;P&gt;Thanks for your swift reply, however I have to admit having challenges putting this into my script.&lt;/P&gt;
&lt;P&gt;I am loading the files from a local folder:&lt;/P&gt;
&lt;P&gt;FileName:&lt;/P&gt;
&lt;P&gt;LOAD&lt;/P&gt;
&lt;P&gt;FileName() as FileName,&lt;BR /&gt;(Date(Date#(left(right(FileName(),13),8),'YYYYMMDD'))) as Date,&lt;BR /&gt;(Date(Date#(left(right(FileName(),9),2),'YYYYMMDD'))) as Month&lt;BR /&gt;&lt;BR /&gt;FROM&lt;BR /&gt;RAWDATA\Report1_*.xlsx&lt;BR /&gt;(ooxml, embedded labels, header is 5 lines, table is );&lt;BR /&gt;&lt;BR /&gt;Could you kindy help me out with the mapping logic?&lt;/P&gt;
&lt;P&gt;Appreciate your knowledge.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Greetings&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Michael&lt;/P&gt;</description>
    <pubDate>Sun, 30 Jan 2022 12:46:18 GMT</pubDate>
    <dc:creator>MME2</dc:creator>
    <dc:date>2022-01-30T12:46:18Z</dc:date>
    <item>
      <title>Mark Files with hihgest Date</title>
      <link>https://community.qlik.com/t5/Connectivity-Data-Prep/Mark-Files-with-hihgest-Date/m-p/1886808#M10145</link>
      <description>&lt;P&gt;Dear All,&lt;/P&gt;
&lt;P&gt;Thanks in advance for your support. Allow me to share my challenge:&lt;/P&gt;
&lt;P&gt;I am want to flag a filename which has the highest date in the month.&lt;/P&gt;
&lt;P&gt;I am storing reports every week with the follwing naming convention:&lt;/P&gt;
&lt;P&gt;Report1_YYYYMMDD.xlsx&lt;/P&gt;
&lt;P&gt;For certain reporting purposes I need to report weekly (which is easy based on the import structure).&lt;/P&gt;
&lt;P&gt;I need to build no however a monthly report which gives me the current month, but also the value of the last month.&lt;/P&gt;
&lt;P&gt;What I can do is building an average base don the files (as the values can change week over week) that's why I always want to take the value from the file of the latest week in that month.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;My Idea was to flag the file with the highest week on the month and then can use set analysis in the chart.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;Here is what I would like to achieve:&lt;/P&gt;
&lt;P&gt;Report&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; |&amp;nbsp; &amp;nbsp;Flag&lt;/P&gt;
&lt;P&gt;-------------------------------------------------&lt;/P&gt;
&lt;P&gt;Report1_20220101&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| No&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Report1_20220107&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| Yes&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Report1_20220202&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; | No&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Report1_20220215&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| No&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Report1_20220220&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| Yes&lt;BR /&gt;&lt;BR /&gt;Does anybody have an idea how to resolve this?&lt;/P&gt;
&lt;P&gt;Many thanks for your support &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 30 Jan 2022 06:50:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Connectivity-Data-Prep/Mark-Files-with-hihgest-Date/m-p/1886808#M10145</guid>
      <dc:creator>MME2</dc:creator>
      <dc:date>2022-01-30T06:50:33Z</dc:date>
    </item>
    <item>
      <title>Re: Mark Files with hihgest Date</title>
      <link>https://community.qlik.com/t5/Connectivity-Data-Prep/Mark-Files-with-hihgest-Date/m-p/1886810#M10146</link>
      <description>&lt;P&gt;You can solve this by creating a mapping table like below.&lt;/P&gt;
&lt;P&gt;[Map_maxreport]:&lt;/P&gt;
&lt;P&gt;Mapping Load&amp;nbsp;&lt;/P&gt;
&lt;P&gt;maxstring(Report) as Report,&lt;/P&gt;
&lt;P&gt;'Yes' as _isMonthlyMaxReport&lt;/P&gt;
&lt;P&gt;Inline&amp;nbsp; [&lt;/P&gt;
&lt;P&gt;Report&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Report1_20220101&lt;/P&gt;
&lt;P&gt;Report1_20220107&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Report1_20220202&lt;/P&gt;
&lt;P&gt;Report1_20220215&lt;/P&gt;
&lt;P&gt;Report1_20220220 ]&lt;/P&gt;
&lt;P&gt;Group By left(Report,14);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then use it with 'No' as default value when loading your Report names.&lt;/P&gt;
&lt;P&gt;Load Report,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;applymap('Map_maxreport',Report,'No') as Flag&lt;/P&gt;
&lt;P&gt;Inline&amp;nbsp; [&lt;/P&gt;
&lt;P&gt;Report&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Report1_20220101&lt;/P&gt;
&lt;P&gt;Report1_20220107&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Report1_20220202&lt;/P&gt;
&lt;P&gt;Report1_20220215&lt;/P&gt;
&lt;P&gt;Report1_20220220 ];&lt;/P&gt;</description>
      <pubDate>Sun, 30 Jan 2022 07:16:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Connectivity-Data-Prep/Mark-Files-with-hihgest-Date/m-p/1886810#M10146</guid>
      <dc:creator>Vegar</dc:creator>
      <dc:date>2022-01-30T07:16:49Z</dc:date>
    </item>
    <item>
      <title>Re: Mark Files with hihgest Date</title>
      <link>https://community.qlik.com/t5/Connectivity-Data-Prep/Mark-Files-with-hihgest-Date/m-p/1886826#M10147</link>
      <description>&lt;P&gt;Thanks for your swift reply, however I have to admit having challenges putting this into my script.&lt;/P&gt;
&lt;P&gt;I am loading the files from a local folder:&lt;/P&gt;
&lt;P&gt;FileName:&lt;/P&gt;
&lt;P&gt;LOAD&lt;/P&gt;
&lt;P&gt;FileName() as FileName,&lt;BR /&gt;(Date(Date#(left(right(FileName(),13),8),'YYYYMMDD'))) as Date,&lt;BR /&gt;(Date(Date#(left(right(FileName(),9),2),'YYYYMMDD'))) as Month&lt;BR /&gt;&lt;BR /&gt;FROM&lt;BR /&gt;RAWDATA\Report1_*.xlsx&lt;BR /&gt;(ooxml, embedded labels, header is 5 lines, table is );&lt;BR /&gt;&lt;BR /&gt;Could you kindy help me out with the mapping logic?&lt;/P&gt;
&lt;P&gt;Appreciate your knowledge.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Greetings&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Michael&lt;/P&gt;</description>
      <pubDate>Sun, 30 Jan 2022 12:46:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Connectivity-Data-Prep/Mark-Files-with-hihgest-Date/m-p/1886826#M10147</guid>
      <dc:creator>MME2</dc:creator>
      <dc:date>2022-01-30T12:46:18Z</dc:date>
    </item>
    <item>
      <title>Re: Mark Files with hihgest Date</title>
      <link>https://community.qlik.com/t5/Connectivity-Data-Prep/Mark-Files-with-hihgest-Date/m-p/1886861#M10149</link>
      <description>&lt;P&gt;With that approach you will get a duplicate row for all rows in your xlsx files. An better approach would be just to look at the filenames and not load the xlsx it self.&amp;nbsp; (I also notice that your month calculation will not return any values)&lt;/P&gt;
&lt;P&gt;Consider this:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;For each _file in filelist('RAWDATA\Report1_*.xlsx')&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;FilenameList:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;Load '$(_file)' as _filename&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;AutoGenerate 1;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;next&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;MAP_Flag:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;Mapping LOAD&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;Maxstring(_filename),&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;'Yes'&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;Resident FilenameList&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;Group By &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;monthname(Date#(left(right(_filename,13),8),'YYYYMMDD')) &lt;FONT color="#339966"&gt;//Unique per year-month&lt;/FONT&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;FileName:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;NoConcatenate LOAD&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;_filename as &lt;SPAN&gt;FileName&lt;/SPAN&gt;,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;Date#(left(right(_filename,13),8),'YYYYMMDD') as Date,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;ApplyMap('MAP_Flag',_filename,'No') as Flag&lt;FONT color="#339966"&gt; //Will return Yes if exists in map else it will be No&lt;/FONT&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;Resident FilenameList;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier" size="2"&gt;drop table FilenameList&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 30 Jan 2022 21:01:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Connectivity-Data-Prep/Mark-Files-with-hihgest-Date/m-p/1886861#M10149</guid>
      <dc:creator>Vegar</dc:creator>
      <dc:date>2022-01-30T21:01:25Z</dc:date>
    </item>
    <item>
      <title>Re: Mark Files with hihgest Date</title>
      <link>https://community.qlik.com/t5/Connectivity-Data-Prep/Mark-Files-with-hihgest-Date/m-p/1886908#M10152</link>
      <description>&lt;P&gt;Hi Vegar,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;many thanks again for your prompt and great support.&lt;/P&gt;
&lt;P&gt;I will put it into my script and see if it works there.&lt;/P&gt;
&lt;P&gt;In a dummy file it was working already as expected.&lt;/P&gt;
&lt;P&gt;Again many thanks and appreciate the great and nice support!&lt;/P&gt;
&lt;P&gt;Have a great week.&lt;/P&gt;</description>
      <pubDate>Mon, 31 Jan 2022 06:33:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Connectivity-Data-Prep/Mark-Files-with-hihgest-Date/m-p/1886908#M10152</guid>
      <dc:creator>MME2</dc:creator>
      <dc:date>2022-01-31T06:33:20Z</dc:date>
    </item>
  </channel>
</rss>

