<?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: LookUP the person's UNIT if he exists in the last year in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/LookUP-the-person-s-UNIT-if-he-exists-in-the-last-year/m-p/2296817#M34010</link>
    <description>&lt;P&gt;I think LOOKUPVALUE should work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As a calculated column, it would look like this:&lt;/P&gt;
&lt;LI-CODE lang="php"&gt;PY Unit =
LOOKUPVALUE (
    Data[Unit],
    Data[Person ID], Data[Person ID],
    Data[Date], DATE ( YEAR ( Data[Date] ) - 1, 1, 1 )
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are plenty of other ways to do this though. I might do this if I were writing a measure:&lt;/P&gt;
&lt;LI-CODE lang="php"&gt;PY Unit =
CALCULATE (
    SELECTEDVALUE ( Data[Unit] ),
    ALLEXCEPT ( Data, Data[Person ID] ),
    DATEADD ( Data[Date], -1, YEAR )
)&lt;/LI-CODE&gt;</description>
    <pubDate>Sat, 22 Jan 2022 23:46:04 GMT</pubDate>
    <dc:creator>AlexisOlson</dc:creator>
    <dc:date>2022-01-22T23:46:04Z</dc:date>
    <item>
      <title>LookUP the person's UNIT if he exists in the last year</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/LookUP-the-person-s-UNIT-if-he-exists-in-the-last-year/m-p/2296598#M34005</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hello everyone,&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I'm trying to find the previous year's (YEAR-1) UNIT for each PERSON ID in each row.&lt;/DIV&gt;&lt;DIV&gt;Can someone help me with this? How can I do this using a MEASURE?&amp;nbsp; I'm so new to power BI, struggling&amp;nbsp;with various approaches.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;P&gt;&lt;STRONG&gt;ACTUAL DATA:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;PERSON ID | DATE | UNIT&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;123 | 01-01-2021 | SBS-EM&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;123 | 01-01-2020 | SBS-EM&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;123 | 01-01-2018 | SBS-EM&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;123 | 01-01-2017 | SBS-EM&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;789 | 01-01-2021 | XYZ&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;789 | 01-01-2020 | XYZ&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;789 | 01-01-2019 | XYZ&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;789 | 01-01-2018 | XYZ&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;789 | 01-01-2017 | XYZ&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;DESIRED OUTPUT (PREVIOUS YEAR UNIT column):&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;PERSON ID | DATE | UNIT | PREVIOUS YEAR UNIT&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;123 | 01-01-2021 | SBS-EM | SBS-EM&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;123 | 01-01-2020 | SBS-EM |&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;123 | 01-01-2018 | SBS-EM | SBS-EM&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;123 | 01-01-2017 | SBS-EM |&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;789 | 01-01-2021 | XYZ | XYZ&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;789 | 01-01-2020 | XYZ | XYZ&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;789 | 01-01-2019 | XYZ | XYZ&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;789 | 01-01-2018 | XYZ | XYZ&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;789 | 01-01-2017 | XYZ |&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PFB the screenshot of the same.&lt;/P&gt;&lt;img /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thanks a ton for your help&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Regards&lt;/DIV&gt;&lt;DIV&gt;Santosh&lt;/DIV&gt;</description>
      <pubDate>Sun, 23 Jan 2022 05:27:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/LookUP-the-person-s-UNIT-if-he-exists-in-the-last-year/m-p/2296598#M34005</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-01-23T05:27:00Z</dc:date>
    </item>
    <item>
      <title>Re: LookUP the person's UNIT if he exists in the last year</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/LookUP-the-person-s-UNIT-if-he-exists-in-the-last-year/m-p/2296817#M34010</link>
      <description>&lt;P&gt;I think LOOKUPVALUE should work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As a calculated column, it would look like this:&lt;/P&gt;
&lt;LI-CODE lang="php"&gt;PY Unit =
LOOKUPVALUE (
    Data[Unit],
    Data[Person ID], Data[Person ID],
    Data[Date], DATE ( YEAR ( Data[Date] ) - 1, 1, 1 )
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are plenty of other ways to do this though. I might do this if I were writing a measure:&lt;/P&gt;
&lt;LI-CODE lang="php"&gt;PY Unit =
CALCULATE (
    SELECTEDVALUE ( Data[Unit] ),
    ALLEXCEPT ( Data, Data[Person ID] ),
    DATEADD ( Data[Date], -1, YEAR )
)&lt;/LI-CODE&gt;</description>
      <pubDate>Sat, 22 Jan 2022 23:46:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/LookUP-the-person-s-UNIT-if-he-exists-in-the-last-year/m-p/2296817#M34010</guid>
      <dc:creator>AlexisOlson</dc:creator>
      <dc:date>2022-01-22T23:46:04Z</dc:date>
    </item>
    <item>
      <title>Re: LookUP the person's UNIT if he exists in the last year</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/LookUP-the-person-s-UNIT-if-he-exists-in-the-last-year/m-p/2296955#M34013</link>
      <description>&lt;P&gt;Thank you for the quick response and solution.&lt;/P&gt;&lt;P&gt;It almost worked, but even when there is no data in the previous year, this measure is giving the unit.&lt;/P&gt;&lt;P&gt;For example for the person with ID 123 for DATE 01-01-2020,even when there is no record in 2019, the measure is giving PY UNIT as SBS-EM&lt;/P&gt;</description>
      <pubDate>Sun, 23 Jan 2022 08:19:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/LookUP-the-person-s-UNIT-if-he-exists-in-the-last-year/m-p/2296955#M34013</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-01-23T08:19:25Z</dc:date>
    </item>
    <item>
      <title>Re: LookUP the person's UNIT if he exists in the last year</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/LookUP-the-person-s-UNIT-if-he-exists-in-the-last-year/m-p/2297345#M34019</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;You may download my PBI file from &lt;A href="https://1drv.ms/u/s!AnsG4LrWCkhUn_8BGc6Lq7d0CI_IEA?e=TSDITh" target="_self"&gt;here&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;Hope this helps.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 23 Jan 2022 23:28:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/LookUP-the-person-s-UNIT-if-he-exists-in-the-last-year/m-p/2297345#M34019</guid>
      <dc:creator>Ashish_Mathur</dc:creator>
      <dc:date>2022-01-23T23:28:44Z</dc:date>
    </item>
    <item>
      <title>Re: LookUP the person's UNIT if he exists in the last year</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/LookUP-the-person-s-UNIT-if-he-exists-in-the-last-year/m-p/2298908#M34044</link>
      <description>&lt;P&gt;Odd. I'm not seeing that in my testing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have a date dimension (calendar) table, you should be able to simplify it a bit.&lt;/P&gt;
&lt;LI-CODE lang="php"&gt;PY Unit = 
CALCULATE (
    SELECTEDVALUE ( Data[Unit] ),
    DATEADD ( dimDate[Date], -1, YEAR )
)&lt;/LI-CODE&gt;
&lt;P&gt;You can also use &lt;A href="https://dax.guide/parallelperiod/" target="_blank"&gt;PARALLELPERIOD&lt;/A&gt; or &lt;A href="https://dax.guide/sameperiodlastyear/" target="_blank"&gt;SAMEPERIODLASTYEAR&lt;/A&gt; instead of &lt;A href="https://dax.guide/dateadd/" target="_blank"&gt;DATEADD&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jan 2022 15:47:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/LookUP-the-person-s-UNIT-if-he-exists-in-the-last-year/m-p/2298908#M34044</guid>
      <dc:creator>AlexisOlson</dc:creator>
      <dc:date>2022-01-24T15:47:34Z</dc:date>
    </item>
  </channel>
</rss>

