<?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: Getting the Previous Value in a Matrix with 7 rows in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Getting-the-Previous-Value-in-a-Matrix-with-7-rows/m-p/4332711#M172005</link>
    <description>&lt;P&gt;Thank you for this but the formula for `pr1` isn't quite right.&lt;BR /&gt;My bad,&amp;nbsp; my explanation for expected output wasn't clear.&lt;BR /&gt;&lt;BR /&gt;As you will notice that not every change is being highlighted as red or green.&lt;BR /&gt;For example, Rev1 on row 6 should be in green. Value went up from 30527.25 to 30346.50&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;pr1 = 
var eosw = max(test[EndOfSnapshotWeek])
RETURN CALCULATE(
            sum(test[Rev1]),
            test[EndOfSnapshotWeek]=eosw-7
        )&lt;/LI-CODE&gt;&lt;P&gt;I require it to match this visual calculation&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;vcPr1 = PREVIOUS([Rev1], 1, COLUMNS)&lt;/LI-CODE&gt;&lt;P&gt;As you can see they don't match&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;My X axis is driven by the fact table because the active relationship between the fact table and the calendar table is on a different date column in the fact table.&lt;/P&gt;</description>
    <pubDate>Tue, 17 Dec 2024 09:24:35 GMT</pubDate>
    <dc:creator>MrHajiCoolBreez</dc:creator>
    <dc:date>2024-12-17T09:24:35Z</dc:date>
    <item>
      <title>Getting the Previous Value in a Matrix with 7 rows</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Getting-the-Previous-Value-in-a-Matrix-with-7-rows/m-p/4330910#M171916</link>
      <description>&lt;P&gt;I have a Matrix which looks like this&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have 7 Columns in ROWS&lt;BR /&gt;"EndOfSnapShotWeek" in the COLUMNS&lt;BR /&gt;and "Rev1" and "Rev2" in the VALUES&lt;BR /&gt;&lt;BR /&gt;I want to create two measures that will calculate whether the "Rev1" or "Rev2" VALUES has gone up/down compared to the previous week (EndOfSnapShotWeek column.).&lt;BR /&gt;Then I can use that in conditional formatting.&lt;BR /&gt;I can handle the&amp;nbsp;conditional formatting I just need help with the DAX.&lt;BR /&gt;&lt;BR /&gt;Sample PBIX file is attached here&lt;BR /&gt;&lt;A title="Sample PBIX" href="https://we.tl/t-MubsAo2eqH" target="_blank" rel="noopener"&gt;Sample PBIX&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2024 18:46:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Getting-the-Previous-Value-in-a-Matrix-with-7-rows/m-p/4330910#M171916</guid>
      <dc:creator>MrHajiCoolBreez</dc:creator>
      <dc:date>2024-12-16T18:46:11Z</dc:date>
    </item>
    <item>
      <title>Re: Getting the Previous Value in a Matrix with 7 rows</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Getting-the-Previous-Value-in-a-Matrix-with-7-rows/m-p/4330943#M171917</link>
      <description>&lt;P&gt;use Visual Calculations - particularly PREVIOUS.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2024 13:54:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Getting-the-Previous-Value-in-a-Matrix-with-7-rows/m-p/4330943#M171917</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-12-16T13:54:30Z</dc:date>
    </item>
    <item>
      <title>Re: Getting the Previous Value in a Matrix with 7 rows</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Getting-the-Previous-Value-in-a-Matrix-with-7-rows/m-p/4331205#M171936</link>
      <description>&lt;P&gt;This works to calculate the differences but I can't use those &lt;SPAN&gt;Visual Calculations&amp;nbsp;&lt;/SPAN&gt;Measures in the Conditional Formatting.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;They don't appear in the "which field should we base these on" drop down&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2024 15:35:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Getting-the-Previous-Value-in-a-Matrix-with-7-rows/m-p/4331205#M171936</guid>
      <dc:creator>MrHajiCoolBreez</dc:creator>
      <dc:date>2024-12-16T15:35:31Z</dc:date>
    </item>
    <item>
      <title>Re: Getting the Previous Value in a Matrix with 7 rows</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Getting-the-Previous-Value-in-a-Matrix-with-7-rows/m-p/4331212#M171938</link>
      <description>&lt;P&gt;correct, that is a know current limitation&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/power-bi/transform-model/desktop-visual-calculations-overview#considerations-and-limitations" target="_blank"&gt;Using visual calculations in Power BI Desktop - Power BI | Microsoft Learn&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2024 15:38:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Getting-the-Previous-Value-in-a-Matrix-with-7-rows/m-p/4331212#M171938</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-12-16T15:38:55Z</dc:date>
    </item>
    <item>
      <title>Re: Getting the Previous Value in a Matrix with 7 rows</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Getting-the-Previous-Value-in-a-Matrix-with-7-rows/m-p/4331215#M171940</link>
      <description>&lt;P&gt;Do you have a workaround or an alternative approach to solve my initial problem?&lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2024 15:42:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Getting-the-Previous-Value-in-a-Matrix-with-7-rows/m-p/4331215#M171940</guid>
      <dc:creator>MrHajiCoolBreez</dc:creator>
      <dc:date>2024-12-16T15:42:20Z</dc:date>
    </item>
    <item>
      <title>Re: Getting the Previous Value in a Matrix with 7 rows</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Getting-the-Previous-Value-in-a-Matrix-with-7-rows/m-p/4331343#M171948</link>
      <description>&lt;P&gt;Short of materializing your result into a calculated table? Don't think so.&amp;nbsp; But worth a try.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please provide sample data that covers your issue or question &lt;STRONG&gt;completely&lt;/STRONG&gt;, in a &lt;STRONG&gt;usable&lt;/STRONG&gt; format (not as a screenshot).&lt;BR /&gt;Do not include sensitive information. Do not include anything that is unrelated to the issue or question. &lt;BR /&gt;Please show the expected outcome based on the sample data you provided. &lt;BR /&gt;&lt;BR /&gt;Need help uploading data? &lt;A href="https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216" target="_blank"&gt;https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216&lt;/A&gt; &lt;BR /&gt;Want faster answers? &lt;A href="https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523" target="_blank"&gt;https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2024 17:16:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Getting-the-Previous-Value-in-a-Matrix-with-7-rows/m-p/4331343#M171948</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-12-16T17:16:57Z</dc:date>
    </item>
    <item>
      <title>Re: Getting the Previous Value in a Matrix with 7 rows</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Getting-the-Previous-Value-in-a-Matrix-with-7-rows/m-p/4331414#M171951</link>
      <description>&lt;P&gt;Here is a PBIX file with sample data&lt;BR /&gt;&lt;A title="Sample PBIX" href="https://we.tl/t-MubsAo2eqH" target="_blank" rel="noopener"&gt;Sample PBIX&lt;/A&gt;&amp;nbsp;&lt;BR /&gt;I don't have super user access so I can't directly attached a PBIX so I'm using WeTrasfer&lt;BR /&gt;&lt;BR /&gt;With regards to expected output, if you can create 2 measures that I can use in conditional formating that shows the difference between Rev1 and Rev2 with the previous week that would be ideal&lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2024 18:48:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Getting-the-Previous-Value-in-a-Matrix-with-7-rows/m-p/4331414#M171951</guid>
      <dc:creator>MrHajiCoolBreez</dc:creator>
      <dc:date>2024-12-16T18:48:37Z</dc:date>
    </item>
    <item>
      <title>Re: Getting the Previous Value in a Matrix with 7 rows</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Getting-the-Previous-Value-in-a-Matrix-with-7-rows/m-p/4331838#M171973</link>
      <description>&lt;P&gt;You have interesting data including negative numbers. Calculating a WoW with a mix of positive and negative numbers is extremely subjective.&amp;nbsp; Make sure you agree with the formula.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's my (subjective) version:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Rev1 change = 
var pr1 = CALCULATE(sum(test[Rev1]),DATEADD('Calendar'[Date],-7,DAY))
return divide(sum(test[Rev1])-pr1,abs(pr1),1)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However your x axis is driven by a fact date (end of snapshot week) and not by the dimension date as it should be . You will want to correct that too ( or modify the above formula)&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;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Dec 2024 01:26:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Getting-the-Previous-Value-in-a-Matrix-with-7-rows/m-p/4331838#M171973</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-12-17T01:26:25Z</dc:date>
    </item>
    <item>
      <title>Re: Getting the Previous Value in a Matrix with 7 rows</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Getting-the-Previous-Value-in-a-Matrix-with-7-rows/m-p/4332711#M172005</link>
      <description>&lt;P&gt;Thank you for this but the formula for `pr1` isn't quite right.&lt;BR /&gt;My bad,&amp;nbsp; my explanation for expected output wasn't clear.&lt;BR /&gt;&lt;BR /&gt;As you will notice that not every change is being highlighted as red or green.&lt;BR /&gt;For example, Rev1 on row 6 should be in green. Value went up from 30527.25 to 30346.50&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;pr1 = 
var eosw = max(test[EndOfSnapshotWeek])
RETURN CALCULATE(
            sum(test[Rev1]),
            test[EndOfSnapshotWeek]=eosw-7
        )&lt;/LI-CODE&gt;&lt;P&gt;I require it to match this visual calculation&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;vcPr1 = PREVIOUS([Rev1], 1, COLUMNS)&lt;/LI-CODE&gt;&lt;P&gt;As you can see they don't match&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;My X axis is driven by the fact table because the active relationship between the fact table and the calendar table is on a different date column in the fact table.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Dec 2024 09:24:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Getting-the-Previous-Value-in-a-Matrix-with-7-rows/m-p/4332711#M172005</guid>
      <dc:creator>MrHajiCoolBreez</dc:creator>
      <dc:date>2024-12-17T09:24:35Z</dc:date>
    </item>
    <item>
      <title>Re: Getting the Previous Value in a Matrix with 7 rows</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Getting-the-Previous-Value-in-a-Matrix-with-7-rows/m-p/4333198#M172037</link>
      <description>&lt;P&gt;As you can see in my example I included a neutral area of +/- 5%.&amp;nbsp; Feel free to modify that.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Dec 2024 13:51:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Getting-the-Previous-Value-in-a-Matrix-with-7-rows/m-p/4333198#M172037</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-12-17T13:51:22Z</dc:date>
    </item>
    <item>
      <title>Re: Getting the Previous Value in a Matrix with 7 rows</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Getting-the-Previous-Value-in-a-Matrix-with-7-rows/m-p/4334787#M172105</link>
      <description>Cool, thanks. All working now</description>
      <pubDate>Wed, 18 Dec 2024 09:43:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Getting-the-Previous-Value-in-a-Matrix-with-7-rows/m-p/4334787#M172105</guid>
      <dc:creator>MrHajiCoolBreez</dc:creator>
      <dc:date>2024-12-18T09:43:32Z</dc:date>
    </item>
  </channel>
</rss>

