<?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: LookupValue in one table based on time period in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/LookupValue-in-one-table-based-on-time-period/m-p/3285770#M122148</link>
    <description>&lt;P&gt;You can try&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Lost clients =
VAR MaxYear =
    CALCULATE ( YEAR ( MAX ( 'Table'[Date] ) ), REMOVEFILTERS () )
VAR PrevYear = MaxYear - 1
VAR CurrentYearClients =
    CALCULATETABLE (
        VALUES ( 'Table'[Client ID] ),
        TREATAS ( { MaxYear }, 'Date'[Year] ),
        REMOVEFILTERS ( 'Date' )
    )
VAR PrevYearClients =
    CALCULATETABLE (
        VALUES ( 'Table'[Client ID] ),
        TREATAS ( { PrevYear }, 'Date'[Year] ),
        REMOVEFILTERS ( 'Date' )
    )
VAR NumLostClients =
    COUNTROWS ( EXCEPT ( PrevYearClients, CurrentYearClients ) )
RETURN
    NumLostClients
&lt;/LI-CODE&gt;</description>
    <pubDate>Thu, 15 Jun 2023 10:59:00 GMT</pubDate>
    <dc:creator>johnt75</dc:creator>
    <dc:date>2023-06-15T10:59:00Z</dc:date>
    <item>
      <title>LookupValue in one table based on time period</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/LookupValue-in-one-table-based-on-time-period/m-p/3285686#M122137</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to find a meassure for this example. I have one table of 2 years period (2021-2022), which includes client IDs and they can repeat. I need to calculate distinctcount of client IDs, which exists in 2021, but not exist in 2022.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;In this example it should be distinctcount of klient_id = 2 (K100001 and K100003), because these are in 2021, but not in 2022. Also, I would like to use the meassure in bigger dataset then, so the meassure should comparing always last 12 months of date and previous 12 months from it (2021 and 2022; 2020 and 2021; 2019 and 2020; etc.).&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Thanks for help.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2023 10:05:47 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/LookupValue-in-one-table-based-on-time-period/m-p/3285686#M122137</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-06-15T10:05:47Z</dc:date>
    </item>
    <item>
      <title>Re: LookupValue in one table based on time period</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/LookupValue-in-one-table-based-on-time-period/m-p/3285770#M122148</link>
      <description>&lt;P&gt;You can try&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Lost clients =
VAR MaxYear =
    CALCULATE ( YEAR ( MAX ( 'Table'[Date] ) ), REMOVEFILTERS () )
VAR PrevYear = MaxYear - 1
VAR CurrentYearClients =
    CALCULATETABLE (
        VALUES ( 'Table'[Client ID] ),
        TREATAS ( { MaxYear }, 'Date'[Year] ),
        REMOVEFILTERS ( 'Date' )
    )
VAR PrevYearClients =
    CALCULATETABLE (
        VALUES ( 'Table'[Client ID] ),
        TREATAS ( { PrevYear }, 'Date'[Year] ),
        REMOVEFILTERS ( 'Date' )
    )
VAR NumLostClients =
    COUNTROWS ( EXCEPT ( PrevYearClients, CurrentYearClients ) )
RETURN
    NumLostClients
&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 15 Jun 2023 10:59:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/LookupValue-in-one-table-based-on-time-period/m-p/3285770#M122148</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2023-06-15T10:59:00Z</dc:date>
    </item>
    <item>
      <title>Re: LookupValue in one table based on time period</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/LookupValue-in-one-table-based-on-time-period/m-p/3285775#M122150</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;BR /&gt;Do do you want to compare current year with the previous year or compare the past 12 months (from the max date available in the current filter context) to the 12 months before? Do you have adate table?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2023 11:03:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/LookupValue-in-one-table-based-on-time-period/m-p/3285775#M122150</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2023-06-15T11:03:38Z</dc:date>
    </item>
    <item>
      <title>Re: LookupValue in one table based on time period</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/LookupValue-in-one-table-based-on-time-period/m-p/3285819#M122157</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to compare the past 12 months to the 12 months before.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2023 11:35:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/LookupValue-in-one-table-based-on-time-period/m-p/3285819#M122157</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-06-15T11:35:14Z</dc:date>
    </item>
    <item>
      <title>Re: LookupValue in one table based on time period</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/LookupValue-in-one-table-based-on-time-period/m-p/3285828#M122158</link>
      <description>&lt;P&gt;This works, thank you &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2023 11:50:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/LookupValue-in-one-table-based-on-time-period/m-p/3285828#M122158</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-06-15T11:50:39Z</dc:date>
    </item>
  </channel>
</rss>

