<?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: Return text value from previous month in a straight table in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Return-text-value-from-previous-month-in-a-straight-table/m-p/1938336#M77341</link>
    <description>&lt;P&gt;The straight table should only show employees in the current month, so the Above function wouldn't work in the straight table?&lt;/P&gt;</description>
    <pubDate>Wed, 01 Jun 2022 12:07:37 GMT</pubDate>
    <dc:creator>zakpullen</dc:creator>
    <dc:date>2022-06-01T12:07:37Z</dc:date>
    <item>
      <title>Return text value from previous month in a straight table</title>
      <link>https://community.qlik.com/t5/App-Development/Return-text-value-from-previous-month-in-a-straight-table/m-p/1938315#M77336</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Staff data is stored on a month by month basis. I'd like to show in a straight table an employee's current department (simple), but also the one they were in last month to identify changes. I'm not sure if this is best handled in the script or the straight table.&lt;/P&gt;
&lt;P&gt;MonthYear is part of the mastercalendar, and used in other calculations spanning time.&lt;/P&gt;
&lt;P&gt;A simplified version of the staff data is below. How would I show the employee department for Mar 2022, alongside the Apr 2022 department in a straight table?&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="tbl2.JPG" style="width: 358px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/80795i03168561565F84AD/image-size/large?v=v2&amp;amp;px=999" role="button" title="tbl2.JPG" alt="tbl2.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Many thanks&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jun 2022 11:35:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Return-text-value-from-previous-month-in-a-straight-table/m-p/1938315#M77336</guid>
      <dc:creator>zakpullen</dc:creator>
      <dc:date>2022-06-01T11:35:48Z</dc:date>
    </item>
    <item>
      <title>Re: Return text value from previous month in a straight table</title>
      <link>https://community.qlik.com/t5/App-Development/Return-text-value-from-previous-month-in-a-straight-table/m-p/1938316#M77337</link>
      <description>&lt;P&gt;Have you tried using Above(Department)?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jun 2022 11:38:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Return-text-value-from-previous-month-in-a-straight-table/m-p/1938316#M77337</guid>
      <dc:creator>Or</dc:creator>
      <dc:date>2022-06-01T11:38:27Z</dc:date>
    </item>
    <item>
      <title>Re: Return text value from previous month in a straight table</title>
      <link>https://community.qlik.com/t5/App-Development/Return-text-value-from-previous-month-in-a-straight-table/m-p/1938318#M77338</link>
      <description>&lt;P&gt;Thanks for your response.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I just tried that in the straight table, and where it returns values, they are random in relation to the employee.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jun 2022 11:43:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Return-text-value-from-previous-month-in-a-straight-table/m-p/1938318#M77338</guid>
      <dc:creator>zakpullen</dc:creator>
      <dc:date>2022-06-01T11:43:40Z</dc:date>
    </item>
    <item>
      <title>Re: Return text value from previous month in a straight table</title>
      <link>https://community.qlik.com/t5/App-Development/Return-text-value-from-previous-month-in-a-straight-table/m-p/1938328#M77340</link>
      <description>&lt;P&gt;If your sort order is month --&amp;gt; employee, then this will indeed not work, as the row above the current one might be an entirely different employee. If your sort order is employee --&amp;gt; month, it should work correctly:&lt;/P&gt;
&lt;P&gt;Load * INLINE [&lt;BR /&gt;MonthYear, Employee Number, Department&lt;BR /&gt;2022 03, 9999, Dep1&lt;BR /&gt;2022 04, 9999, Dep2&lt;BR /&gt;2022 05, 9999, Dep2&lt;BR /&gt;2022 06, 9999, Dep3&lt;BR /&gt;2022 03, 4444, Dep4&lt;BR /&gt;];&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Or_0-1654084493920.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/80796i87186066610C75C4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Or_0-1654084493920.png" alt="Or_0-1654084493920.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jun 2022 11:55:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Return-text-value-from-previous-month-in-a-straight-table/m-p/1938328#M77340</guid>
      <dc:creator>Or</dc:creator>
      <dc:date>2022-06-01T11:55:15Z</dc:date>
    </item>
    <item>
      <title>Re: Return text value from previous month in a straight table</title>
      <link>https://community.qlik.com/t5/App-Development/Return-text-value-from-previous-month-in-a-straight-table/m-p/1938336#M77341</link>
      <description>&lt;P&gt;The straight table should only show employees in the current month, so the Above function wouldn't work in the straight table?&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jun 2022 12:07:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Return-text-value-from-previous-month-in-a-straight-table/m-p/1938336#M77341</guid>
      <dc:creator>zakpullen</dc:creator>
      <dc:date>2022-06-01T12:07:37Z</dc:date>
    </item>
    <item>
      <title>Re: Return text value from previous month in a straight table</title>
      <link>https://community.qlik.com/t5/App-Development/Return-text-value-from-previous-month-in-a-straight-table/m-p/1938517#M77350</link>
      <description>&lt;P&gt;By definition it would not in this case, but if that's what you're doing, it's actually an entirely different situation and a different approach to a solution. In this case I adjusted the months to be actual dates, so I could use date functions on them:&lt;/P&gt;
&lt;P&gt;Only({&amp;lt; MonthYear = {"$(=Date(AddMonths(MonthYear,-1),'YYYYMM'))" } &amp;gt;} Department)&lt;/P&gt;
&lt;P&gt;Load date#(MonthYear,'YYYYMM') as MonthYear, [Employee Number], [Department] INLINE [&lt;BR /&gt;MonthYear, Employee Number, Department&lt;BR /&gt;202203, 9999, Dep1&lt;BR /&gt;202204, 9999, Dep2&lt;BR /&gt;202203, 4444, Dep4&lt;BR /&gt;202204, 4444, Dep5&lt;BR /&gt;];&lt;/P&gt;
&lt;P&gt;After selecting 202204:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Or_0-1654106980481.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/80826iD07D62337C0E6085/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Or_0-1654106980481.png" alt="Or_0-1654106980481.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jun 2022 18:10:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Return-text-value-from-previous-month-in-a-straight-table/m-p/1938517#M77350</guid>
      <dc:creator>Or</dc:creator>
      <dc:date>2022-06-01T18:10:10Z</dc:date>
    </item>
    <item>
      <title>Re: Return text value from previous month in a straight table</title>
      <link>https://community.qlik.com/t5/App-Development/Return-text-value-from-previous-month-in-a-straight-table/m-p/1940287#M77509</link>
      <description>&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;I was able to replicate your example in a separate qv app, but applying it to the dataset I'm using is proving trickier.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Instead of using MonthYear, I created a new field called SIPDT. It uses the same load expression as yours, (date#(PeriodDate,'YYYYMM') as SIPDT), so should work.&lt;/P&gt;
&lt;P&gt;The problem arises when this is used in the formula you provided, specifically this section - Date(AddMonths(SIPDT,-1),'YYYYMM')&lt;/P&gt;
&lt;P&gt;Below shows dates, the correct result when formatted as a number, and the numbers actually being produced. A 5 digit number becomes a 6 digit number, but the first 3 digits correspond correctly.&lt;/P&gt;
&lt;P&gt;Below the table is an image of the full expression in a straight table.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="date.JPG" style="width: 274px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/81121i70355C75F1E63B48/image-size/large?v=v2&amp;amp;px=999" role="button" title="date.JPG" alt="date.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I'm baffled!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jun 2022 10:26:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Return-text-value-from-previous-month-in-a-straight-table/m-p/1940287#M77509</guid>
      <dc:creator>zakpullen</dc:creator>
      <dc:date>2022-06-07T10:26:16Z</dc:date>
    </item>
    <item>
      <title>Re: Return text value from previous month in a straight table</title>
      <link>https://community.qlik.com/t5/App-Development/Return-text-value-from-previous-month-in-a-straight-table/m-p/1940387#M77515</link>
      <description>&lt;P&gt;If you apply num() to your date field, you should get the corresponding date value, which should indeed by the "correct result" numbers you're getting. However, in your case you seem to have formatted the date as DD/MM/YYYY, so you'd need to have the set analysis syntax match that. This won't solve the issue of the results being incorrect, though - but I can't really see what the problem is without access to the data, so if you'd like me to look at it I'll need a sample app.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jun 2022 13:04:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Return-text-value-from-previous-month-in-a-straight-table/m-p/1940387#M77515</guid>
      <dc:creator>Or</dc:creator>
      <dc:date>2022-06-07T13:04:12Z</dc:date>
    </item>
    <item>
      <title>Re: Return text value from previous month in a straight table</title>
      <link>https://community.qlik.com/t5/App-Development/Return-text-value-from-previous-month-in-a-straight-table/m-p/1940940#M77549</link>
      <description>&lt;P&gt;The DD/MM/YYYY was just to indicate actual months for the other 2 columns, not part of the app. I've made some progress integrating, I just need to work out how to integrate it with the master calendar so that it responds to listboxes based on financial years and months.&lt;/P&gt;
&lt;P&gt;Many thanks for your help.&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>Wed, 08 Jun 2022 10:59:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Return-text-value-from-previous-month-in-a-straight-table/m-p/1940940#M77549</guid>
      <dc:creator>zakpullen</dc:creator>
      <dc:date>2022-06-08T10:59:58Z</dc:date>
    </item>
  </channel>
</rss>

