<?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: FirstSortedValue of previous year in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/FirstSortedValue-of-previous-year/m-p/2531720#M108034</link>
    <description>&lt;P&gt;I see, thank you. But if I have the year as a column in the reporting table **bleep** doesn't work. It seems like&amp;nbsp; a conflict between the column Year = 2025 and the calculation Year-1 (e.g.2024) at the same time, and it returns nothing...&lt;/P&gt;</description>
    <pubDate>Wed, 24 Sep 2025 12:06:16 GMT</pubDate>
    <dc:creator>jeanful</dc:creator>
    <dc:date>2025-09-24T12:06:16Z</dc:date>
    <item>
      <title>FirstSortedValue of previous year</title>
      <link>https://community.qlik.com/t5/App-Development/FirstSortedValue-of-previous-year/m-p/2531702#M108030</link>
      <description>&lt;P&gt;Hello there,&lt;/P&gt;&lt;P&gt;I have the following script&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;MYTAB_T:
LOAD * INLINE [
Product, Date, Value
BIKE, 05-01-2024, 100
BIKE, 06-01-2024, 200
BIKE, 07-01-2024, 70
JACKET, 06-01-2024, 10
JACKET, 09-01-2024, 20
JACKET, 10-01-2024, 50
BIKE, 02-01-2025, 1000
BIKE, 03-01-2025, 2000
BIKE, 04-01-2025, 3000
BIKE, 05-01-2025, 990
JACKET, 04-01-2025, 100
JACKET, 05-01-2025, 200
JACKET, 08-01-2025, 500
];

MYTAB:
NoConcatenate
LOAD [Product], Date(Date#([Date], 'MM-dd-yyyy'), 'MM-dd-yyyy') AS [Date], [Value]
RESIDENT MYTAB_T;

DROP TABLE MYTAB_T;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I then built a table in the sheet with: Product, Year(Date) and two measures:&lt;/P&gt;&lt;P&gt;-&amp;nbsp;FirstSortedValue( [Value], [Date] )&lt;BR /&gt;- FirstSortedValue( [Value], -[Date] )&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;These work properly, e.g. BIKE | 2025 | 1000| 990.&lt;/P&gt;&lt;P&gt;I would add a new measure to calcolate the last Value for the previous year.&lt;BR /&gt;E.g. I'd have BIKE | 2025 | 1000| 990 | &lt;STRONG&gt;70 &lt;/STRONG&gt;(where 70 is the last value of BIKE 2024). How can I achieve this?&lt;/P&gt;&lt;P&gt;Thanks!!&lt;/P&gt;</description>
      <pubDate>Wed, 24 Sep 2025 10:01:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/FirstSortedValue-of-previous-year/m-p/2531702#M108030</guid>
      <dc:creator>jeanful</dc:creator>
      <dc:date>2025-09-24T10:01:01Z</dc:date>
    </item>
    <item>
      <title>Re: FirstSortedValue of previous year</title>
      <link>https://community.qlik.com/t5/App-Development/FirstSortedValue-of-previous-year/m-p/2531716#M108031</link>
      <description>&lt;P&gt;Remove the calculated dimension of&amp;nbsp;&lt;SPAN&gt;Year(Date) - year and other period-information should be in general native fields within the data-model and not derived in the UI - from the table and apply 4 expressions like:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;FirstSortedValue({&amp;lt; Year = {2025}&amp;gt;} [Value], [Date])&lt;BR /&gt;FirstSortedValue({&amp;lt; Year = {2025}&amp;gt;} [Value], -[Date])&lt;BR /&gt;FirstSortedValue({&amp;lt; Year = {2024}&amp;gt;} [Value], [Date])&lt;BR /&gt;FirstSortedValue({&amp;lt; Year = {2024}&amp;gt;} [Value], -[Date])&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Sep 2025 11:53:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/FirstSortedValue-of-previous-year/m-p/2531716#M108031</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2025-09-24T11:53:43Z</dc:date>
    </item>
    <item>
      <title>Re: FirstSortedValue of previous year</title>
      <link>https://community.qlik.com/t5/App-Development/FirstSortedValue-of-previous-year/m-p/2531717#M108032</link>
      <description>&lt;P&gt;Thank you! The year must be present in the table, it's a requirement.&lt;BR /&gt;Furthermore, the year can be selected by means of a filter and the solution should retrieve dynamically the previous year (avoiding harcoding like 2025 and 2024).&lt;/P&gt;&lt;P&gt;thank you!&lt;/P&gt;</description>
      <pubDate>Wed, 24 Sep 2025 11:58:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/FirstSortedValue-of-previous-year/m-p/2531717#M108032</guid>
      <dc:creator>jeanful</dc:creator>
      <dc:date>2025-09-24T11:58:01Z</dc:date>
    </item>
    <item>
      <title>Re: FirstSortedValue of previous year</title>
      <link>https://community.qlik.com/t5/App-Development/FirstSortedValue-of-previous-year/m-p/2531719#M108033</link>
      <description>&lt;P&gt;It mustn't be static, for example with:&lt;/P&gt;&lt;P&gt;...&amp;nbsp;&lt;SPAN&gt;{&amp;lt; Year = {"$(=max(Year))"}&amp;gt;}&lt;/SPAN&gt; ...&lt;BR /&gt;...&amp;nbsp;&lt;SPAN&gt;{&amp;lt; Year = {"$(=max(Year)-1)"}&amp;gt;}&lt;/SPAN&gt; ...&lt;/P&gt;&lt;P&gt;and the max() could be also used to label the expression appropriate.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Sep 2025 12:03:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/FirstSortedValue-of-previous-year/m-p/2531719#M108033</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2025-09-24T12:03:59Z</dc:date>
    </item>
    <item>
      <title>Re: FirstSortedValue of previous year</title>
      <link>https://community.qlik.com/t5/App-Development/FirstSortedValue-of-previous-year/m-p/2531720#M108034</link>
      <description>&lt;P&gt;I see, thank you. But if I have the year as a column in the reporting table **bleep** doesn't work. It seems like&amp;nbsp; a conflict between the column Year = 2025 and the calculation Year-1 (e.g.2024) at the same time, and it returns nothing...&lt;/P&gt;</description>
      <pubDate>Wed, 24 Sep 2025 12:06:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/FirstSortedValue-of-previous-year/m-p/2531720#M108034</guid>
      <dc:creator>jeanful</dc:creator>
      <dc:date>2025-09-24T12:06:16Z</dc:date>
    </item>
    <item>
      <title>Re: FirstSortedValue of previous year</title>
      <link>https://community.qlik.com/t5/App-Development/FirstSortedValue-of-previous-year/m-p/2531728#M108035</link>
      <description>&lt;P&gt;Yes, it doesn't work in this way because the 2024 data don't belong to the 2025 and vice versa - which is also completely independent to any selection state respectively set analysis condition.&lt;/P&gt;&lt;P&gt;Therefore my above suggestion as the usually most pragmatic way to create such views. Of course there are other ways, for example:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;using interrecord-functions like above() or before() which give access to any visible cell of the chart&lt;/LI&gt;&lt;LI&gt;adjusting/extending the data-model to appropriate dimensions - maybe with:&amp;nbsp;&lt;A href="https://community.qlik.com/t5/Design/The-As-Of-Table/ba-p/1466130" target="_blank"&gt;The As-Of Table - Qlik Community - 1466130&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;enforcing values against their dimensionalities - applying {1} and TOTAL nearly each value could be assigned to any dimension-value (not recommended)&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Wed, 24 Sep 2025 13:28:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/FirstSortedValue-of-previous-year/m-p/2531728#M108035</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2025-09-24T13:28:06Z</dc:date>
    </item>
  </channel>
</rss>

