<?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: Adding custom column that adds most recent data for rows in historical dimension table in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adding-custom-column-that-adds-most-recent-data-for-rows-in/m-p/3660355#M141828</link>
    <description>&lt;P&gt;First tests are looking very promising! Thank you so much!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm gonna run a few more tests today and tomorrow and if everything works I'll accept this answer as a solution&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 25 Jan 2024 12:21:38 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-01-25T12:21:38Z</dc:date>
    <item>
      <title>Adding custom column that adds most recent data for rows in historical dimension table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adding-custom-column-that-adds-most-recent-data-for-rows-in/m-p/3654032#M141568</link>
      <description>&lt;P&gt;Hi everyone!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a question. We have a dimension table for customers which is set up so it keeps track of history and changes made to the customer data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, if someone from our company changes the address of a company, our stored procedures in our SQL server will add the company as a new row, with the new address, a valid from to range (set to the date when they changed the address) and a "current record flag".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is useful to dynamically change our Fact Invoice data according to history. But now I've run into an issue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The customers have a "credit limit", so just like all the other fields they change according to de valid from to range date based on the year or date you select in our Power BI apps. However I would like to create a column that fills in the most recent "credit limit" value for all the historical rows.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's a visual to explain it a bit:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I add this column (highlighted in orange) in Power BI:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jan 2024 12:33:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adding-custom-column-that-adds-most-recent-data-for-rows-in/m-p/3654032#M141568</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-01-23T12:33:51Z</dc:date>
    </item>
    <item>
      <title>Re: Adding custom column that adds most recent data for rows in historical dimension table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adding-custom-column-that-adds-most-recent-data-for-rows-in/m-p/3655608#M141624</link>
      <description>&lt;P&gt;HI&amp;nbsp;Anonymous&lt;/LI-USER&gt;,&lt;/P&gt;
&lt;P&gt;Current power bi does not support to create dynamic calculated column/table based on filter effect. They not work on the same level and you can't use child level to affect their parent.&lt;/P&gt;
&lt;P&gt;Notice: the data level of power bi(from parent to child level)&lt;/P&gt;
&lt;P&gt;Database(external) -&amp;gt; query table(query, custom function, query parameters) -&amp;gt; data model table(table, calculate column/table) -&amp;gt; data view with virtual tables(measure, visual, filter, slicer)&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Xiaoxin Sheng&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jan 2024 05:07:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adding-custom-column-that-adds-most-recent-data-for-rows-in/m-p/3655608#M141624</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-01-24T05:07:29Z</dc:date>
    </item>
    <item>
      <title>Re: Adding custom column that adds most recent data for rows in historical dimension table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adding-custom-column-that-adds-most-recent-data-for-rows-in/m-p/3655644#M141634</link>
      <description>&lt;P&gt;To achieve this in Power BI, you can create a new column using DAX (Data Analysis Expressions) to fetch the most recent "credit limit" value for each historical row in your customer dimension table. You can use the following steps:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Sort the Customer Dimension Table:&lt;/STRONG&gt; Ensure that your customer dimension table is sorted by the "Valid From" column in descending order so that the most recent record appears first for each customer.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Create a New Column:&lt;/STRONG&gt; Create a new column in Power BI using the following DAX formula. This formula uses the CALCULATE function in combination with FILTER to find the most recent "credit limit" value for each customer based on the sorted order.&lt;/P&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;MostRecentCreditLimit =&lt;BR /&gt;CALCULATE(&lt;BR /&gt;MAX('YourTable'[CreditLimit]),&lt;BR /&gt;FILTER(&lt;BR /&gt;'YourTable',&lt;BR /&gt;'YourTable'[CustomerID] = EARLIER('YourTable'[CustomerID]) &amp;amp;&amp;amp;&lt;BR /&gt;'YourTable'[ValidFrom] &amp;lt;= EARLIER('YourTable'[ValidFrom])&lt;BR /&gt;)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;P&gt;Replace 'YourTable' with the actual name of your customer dimension table, and 'CustomerID', 'CreditLimit', and 'ValidFrom' with the corresponding column names in your table.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;STRONG&gt;Use the New Column in Visualizations:&lt;/STRONG&gt; Once you've added the new column, you can use it in your Power BI visualizations to show the most recent "credit limit" value for each historical row.&lt;/P&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Remember to adjust the column names based on your actual table structure. This DAX formula should provide you with the most recent "credit limit" value for each historical row in your customer dimension table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;If this post&amp;nbsp;helps, then please consider&amp;nbsp;Accepting it as the solution&amp;nbsp;to help the other members find it more quickly.&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;In case there is still a problem, please feel free and explain your issue in detail,&amp;nbsp;It will be my pleasure to assist you in any way I can.&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jan 2024 05:22:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adding-custom-column-that-adds-most-recent-data-for-rows-in/m-p/3655644#M141634</guid>
      <dc:creator>123abc</dc:creator>
      <dc:date>2024-01-24T05:22:33Z</dc:date>
    </item>
    <item>
      <title>Re: Adding custom column that adds most recent data for rows in historical dimension table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adding-custom-column-that-adds-most-recent-data-for-rows-in/m-p/3655750#M141638</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Assuming that most recent credit limit has a valid to date of "9999-12-31" and there will always be only one record for most recent credit limit, another way to write it. This is a calculated column.&lt;/P&gt;&lt;DIV&gt;"&lt;SPAN&gt;DimCustomer[Customername] = _customername&lt;/SPAN&gt;" you can do without it as during context transition, filters are automatically propagated, but I like to do it manually to help my brain convince that context transition is easy &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;//Since we are in a row context, fetching current customer&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt;&lt;SPAN&gt; _customername = DimCustomer[Customername]&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;//for the customer in current row fetching the value of credit limit beased on below filters. Here context transition is happening.&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;return&lt;/SPAN&gt; &lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;VALUES&lt;/SPAN&gt;&lt;SPAN&gt;(DimCustomer[CreditLimit]), &lt;/SPAN&gt;&lt;SPAN&gt;ALLEXCEPT&lt;/SPAN&gt;&lt;SPAN&gt;(DimCustomer, DimCustomer[Customername]), DimCustomer[Customername] = _customername , &lt;/SPAN&gt;&lt;SPAN&gt;FORMAT&lt;/SPAN&gt;&lt;SPAN&gt;(DimCustomer[ValidTo], &lt;/SPAN&gt;&lt;SPAN&gt;"YYYY-MM-DD"&lt;/SPAN&gt;&lt;SPAN&gt;) = &lt;/SPAN&gt;&lt;SPAN&gt;"9999-12-31"&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 24 Jan 2024 06:34:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adding-custom-column-that-adds-most-recent-data-for-rows-in/m-p/3655750#M141638</guid>
      <dc:creator>talespin</dc:creator>
      <dc:date>2024-01-24T06:34:14Z</dc:date>
    </item>
    <item>
      <title>Re: Adding custom column that adds most recent data for rows in historical dimension table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adding-custom-column-that-adds-most-recent-data-for-rows-in/m-p/3656563#M141662</link>
      <description>&lt;P&gt;Thanks! I'll give this a try in a couple of hours and see if it works&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Jan 2024 10:42:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adding-custom-column-that-adds-most-recent-data-for-rows-in/m-p/3656563#M141662</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-01-24T10:42:18Z</dc:date>
    </item>
    <item>
      <title>Re: Adding custom column that adds most recent data for rows in historical dimension table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adding-custom-column-that-adds-most-recent-data-for-rows-in/m-p/3660355#M141828</link>
      <description>&lt;P&gt;First tests are looking very promising! Thank you so much!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm gonna run a few more tests today and tomorrow and if everything works I'll accept this answer as a solution&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":smiling_face_with_smiling_eyes:"&gt;😊&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jan 2024 12:21:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adding-custom-column-that-adds-most-recent-data-for-rows-in/m-p/3660355#M141828</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-01-25T12:21:38Z</dc:date>
    </item>
    <item>
      <title>Re: Adding custom column that adds most recent data for rows in historical dimension table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adding-custom-column-that-adds-most-recent-data-for-rows-in/m-p/3660362#M141829</link>
      <description>&lt;P&gt;I tried this but I still get the same values per row as before, not the most recent ones for all of them ..&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks anyway, I'll try a few more times maybe I'm using the wrong sorting in Power BI?&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jan 2024 12:22:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Adding-custom-column-that-adds-most-recent-data-for-rows-in/m-p/3660362#M141829</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-01-25T12:22:57Z</dc:date>
    </item>
  </channel>
</rss>

