<?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 Confronting a column value month by month in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Confronting-a-column-value-month-by-month/m-p/3980004#M154308</link>
    <description>&lt;P&gt;Hi forum!&lt;/P&gt;&lt;P&gt;I'm fairly new to Dax and Dax Studio and I just got stuck with a problem I can't seem to understand.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I find myself with a table containing 3 main columns:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;The data column, which contains the last day of each month for each year, like 2023/01/31,2023/02/28 and so on.&lt;/LI&gt;&lt;LI&gt;The Code column, which contains an alphanumeric code representing a person.&lt;/LI&gt;&lt;LI&gt;The contract code, containing one of two values representing the type of contract of the person.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Here a simplified example:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I should compare the contract code month by month in order to find the date where the contract code was changed.&lt;/P&gt;&lt;P&gt;I know how to compare two time periods, like 2022 and 2023 for example, but I don't know how to make it&amp;nbsp; among 13 months( the 12 from 2023 + 1 from 2022/31/12). Moreover differently from this example the rows are not in order and there are many more codes representing people.&lt;/P&gt;&lt;P&gt;Thanks in advance to anyone who can give a heads up on how to approach this problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 07 Jun 2024 13:24:11 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-06-07T13:24:11Z</dc:date>
    <item>
      <title>Confronting a column value month by month</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Confronting-a-column-value-month-by-month/m-p/3980004#M154308</link>
      <description>&lt;P&gt;Hi forum!&lt;/P&gt;&lt;P&gt;I'm fairly new to Dax and Dax Studio and I just got stuck with a problem I can't seem to understand.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I find myself with a table containing 3 main columns:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;The data column, which contains the last day of each month for each year, like 2023/01/31,2023/02/28 and so on.&lt;/LI&gt;&lt;LI&gt;The Code column, which contains an alphanumeric code representing a person.&lt;/LI&gt;&lt;LI&gt;The contract code, containing one of two values representing the type of contract of the person.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Here a simplified example:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I should compare the contract code month by month in order to find the date where the contract code was changed.&lt;/P&gt;&lt;P&gt;I know how to compare two time periods, like 2022 and 2023 for example, but I don't know how to make it&amp;nbsp; among 13 months( the 12 from 2023 + 1 from 2022/31/12). Moreover differently from this example the rows are not in order and there are many more codes representing people.&lt;/P&gt;&lt;P&gt;Thanks in advance to anyone who can give a heads up on how to approach this problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jun 2024 13:24:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Confronting-a-column-value-month-by-month/m-p/3980004#M154308</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-06-07T13:24:11Z</dc:date>
    </item>
    <item>
      <title>Re: Confronting a column value month by month</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Confronting-a-column-value-month-by-month/m-p/3980291#M154319</link>
      <description>&lt;P&gt;Can you give an example or mockup of the output you want to create?&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jun 2024 15:04:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Confronting-a-column-value-month-by-month/m-p/3980291#M154319</guid>
      <dc:creator>sjoerdvn</dc:creator>
      <dc:date>2024-06-07T15:04:30Z</dc:date>
    </item>
    <item>
      <title>Re: Confronting a column value month by month</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Confronting-a-column-value-month-by-month/m-p/3980346#M154322</link>
      <description>&lt;P&gt;Something similar to this:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;The goal is to take the initial table,compare each month with its predecessor regarding the contract type, and when the contract type is different between two months we are comparing, output the first month with the new type.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jun 2024 15:26:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Confronting-a-column-value-month-by-month/m-p/3980346#M154322</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-06-07T15:26:04Z</dc:date>
    </item>
    <item>
      <title>Re: Confronting a column value month by month</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Confronting-a-column-value-month-by-month/m-p/3983375#M154445</link>
      <description>&lt;P&gt;Hi Guys!&lt;/P&gt;&lt;P&gt;Yesterday I found the solution, just in case someone has a similar problem, I'll leave it here:&lt;/P&gt;&lt;P&gt;EVALUATE&lt;BR /&gt;VAR Table =&lt;BR /&gt;FILTER(&lt;BR /&gt;SUMMARIZE(&lt;BR /&gt;'Demographic Data',&lt;BR /&gt;'Demographic Data'[Flow Date],&lt;BR /&gt;'Demographic Data'[ID],&lt;BR /&gt;'Demographic Data'[Full Name],&lt;BR /&gt;'Demographic Data'[Contract Type]),&lt;BR /&gt;[Flow Date] &amp;gt; DATE(2022,11,30) &amp;amp;&amp;amp;&lt;BR /&gt;[Flow Date] &amp;lt; DATE(2024,01,31))&lt;/P&gt;&lt;P&gt;VAR Prev_Contract =&lt;BR /&gt;ADDCOLUMNS (&lt;BR /&gt;Table,&lt;BR /&gt;"Prev_Contract",&lt;BR /&gt;VAR ID = [ID]&lt;BR /&gt;VAR Date = [Flow Date]&lt;BR /&gt;VAR Prev_Date = EOMONTH(Date, -1)&lt;BR /&gt;RETURN&lt;BR /&gt;CALCULATE (&lt;BR /&gt;MAX('Demographic Data'[Contract Type]),&lt;BR /&gt;FILTER (&lt;BR /&gt;'Demographic Data',&lt;BR /&gt;'Demographic Data'[ID] = ID &amp;amp;&amp;amp;&lt;BR /&gt;[Flow Date] = Prev_Date)))&lt;/P&gt;&lt;P&gt;VAR Contract_Change =&lt;BR /&gt;ADDCOLUMNS (&lt;BR /&gt;Prev_Contract,&lt;BR /&gt;"Contract Change",&lt;BR /&gt;IF ( [Contract Type] &amp;lt;&amp;gt; [Prev_Contract], "Y", "N"))&lt;BR /&gt;&lt;BR /&gt;VAR Filtered_Change =&lt;BR /&gt;FILTER(&lt;BR /&gt;Contract_Change,&lt;BR /&gt;[Contract Change] = "Y" &amp;amp;&amp;amp;&lt;BR /&gt;[Prev_Contract] &amp;lt;&amp;gt; BLANK())&lt;/P&gt;&lt;P&gt;RETURN&lt;BR /&gt;SELECTCOLUMNS (&lt;BR /&gt;Filtered_Change,&lt;BR /&gt;"ID", [ID],&lt;BR /&gt;"Employee", [Full Name],&lt;BR /&gt;"Previous Contract", [Prev_Contract],&lt;BR /&gt;"Current Contract", [Contract Type],&lt;BR /&gt;"Contract Change", [Contract Change],&lt;BR /&gt;"Change Date", FORMAT([Flow Date], "DD/MM/YYYY"))&lt;/P&gt;&lt;P&gt;ORDER BY [Change Date] Asc&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It works and gives the desired output, but could be made a little bit more efficient syntax wise.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jun 2024 10:59:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Confronting-a-column-value-month-by-month/m-p/3983375#M154445</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-06-10T10:59:38Z</dc:date>
    </item>
  </channel>
</rss>

