<?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: Calculate Difference between Rows for a given Measure in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Difference-between-Rows-for-a-given-Measure/m-p/3913846#M152377</link>
    <description>&lt;P&gt;Hi Anonymous&lt;/LI-USER&gt; thanks for your suggestion and my apologies for my late reply. It seems like I have gone back and had a look at my data. We have decided to narrow down the list of the strings contained in the "Experiment Name" field to those that have a consistent naming format, and thus I think your solution should indeed work. Thanks again for your support!&lt;/P&gt;</description>
    <pubDate>Mon, 13 May 2024 11:48:40 GMT</pubDate>
    <dc:creator>kulpushu</dc:creator>
    <dc:date>2024-05-13T11:48:40Z</dc:date>
    <item>
      <title>Calculate Difference between Rows for a given Measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Difference-between-Rows-for-a-given-Measure/m-p/3895768#M151823</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I want to calculate the relative value of the ATB by PDP visits between the control (off) and the variance (on) as listed below. The experiments are selected by a drop down selection and unfortunately given the set up of the data, one has to select the experiments by typing “Test 1” in the filter window and then selecting “Test 1 Off” and “Test 1 On” from the list. The tests have different names and the user will have to type them out and select the corresponding “off” and “On” selection. I have built the following table using calculation groups in Tabular Editor 3 with "Visits", "ATB Visits" and "ATB by PDP Visits" all being calculation items; however I have a separate measure defined for each calculation item, and thus there is a corresponding measure for ATB by PDP visits which is defined as the percentage of the sum of the ATB visits divided by the sum of the PDP visits.&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;ATBbyPDPVisits =&lt;/SPAN&gt; &lt;SPAN&gt;DIVIDE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;sum&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;FactExp&lt;/SPAN&gt;&lt;SPAN&gt;[visitsATB]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;SPAN&gt;sum&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;FactExp&lt;/SPAN&gt;&lt;SPAN&gt;[visitsPDP]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;STRONG&gt;My goal is to find the percentage change in the ATB by PDP visits for the “Off” and “On” settings? That is, this calculation will be ((14.37-14.5)/14.37*100 = -0.9%)&lt;/STRONG&gt; to be displayed as a separate KPI card, which will change when the selection of the experiment changes. Accounting for this, is there a simple way to calculate the change in Power BI given the fact that it will likely be a division across the selected rows (albeit it will only be for the two selected rows)? &amp;nbsp;Thank you all in advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;Experiment Name&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Visits&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;ATB Visits&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;ATB by PDP Visits %&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;Test 1 Off&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;5560&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;1567&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;14.37%&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;Test 1 On&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;1124&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;7889&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;14.50%&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Expected Result:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;&lt;STRONG&gt;ATB by PDP Visits Change %&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;&lt;STRONG&gt;0.90%&lt;/STRONG&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="6799" data-lia-user-login="OwenAuger" class="lia-mention lia-mention-user"&gt;OwenAuger&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 May 2024 14:39:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Difference-between-Rows-for-a-given-Measure/m-p/3895768#M151823</guid>
      <dc:creator>kulpushu</dc:creator>
      <dc:date>2024-05-06T14:39:35Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Difference between Rows for a given Measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Difference-between-Rows-for-a-given-Measure/m-p/3897137#M151879</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="722547" data-lia-user-login="kulpushu" class="lia-mention lia-mention-user"&gt;kulpushu&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;The Table data is shown below:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Please follow these steps:&lt;BR /&gt;1. Use the following DAX expression to create a column&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Column = LEFT([Experiment Name],6)&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;2.Use the following DAX expression to create a measure&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Off = 
VAR _a = SELECTEDVALUE('Table'[Column])
VAR _b = _a &amp;amp; " Off"

RETURN CALCULATE(DIVIDE(SUM('Table'[ATB Visits]),SUM('Table'[PDP vistis]),0),'Table'[Experiment Name] = _b)&lt;/LI-CODE&gt;
&lt;P&gt;3.Use the following DAX expression to create a measure&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;On = 
VAR _a = SELECTEDVALUE('Table'[Column])
VAR _b = _a &amp;amp; " On"

RETURN CALCULATE(DIVIDE(SUM('Table'[ATB Visits]),SUM('Table'[PDP vistis]),0),'Table'[Experiment Name] = _b)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;4.Final output&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Wenbin Zhou&lt;BR /&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/P&gt;</description>
      <pubDate>Tue, 07 May 2024 02:58:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Difference-between-Rows-for-a-given-Measure/m-p/3897137#M151879</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-05-07T02:58:11Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Difference between Rows for a given Measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Difference-between-Rows-for-a-given-Measure/m-p/3899674#M151979</link>
      <description>&lt;P&gt;Thanks a lot&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;-- I think your procedure works fine when one has specified experiment names and thus can use the "Selected Value" command. Is there a way if the experiment names are a bit jumbled up? I'd written "Test 1 Off" and "Test 1 On" to make things easier for you and other users to see. In reality I have a lot more variations with non-trivial names. Thanks again for spending your time - I understand I should have been more specific, but let me know if you have any other ideas -- Pushkar&lt;/P&gt;</description>
      <pubDate>Tue, 07 May 2024 16:47:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Difference-between-Rows-for-a-given-Measure/m-p/3899674#M151979</guid>
      <dc:creator>kulpushu</dc:creator>
      <dc:date>2024-05-07T16:47:35Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Difference between Rows for a given Measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Difference-between-Rows-for-a-given-Measure/m-p/3901538#M152035</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="722547" data-lia-user-login="kulpushu" class="lia-mention lia-mention-user"&gt;kulpushu&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;Do your experiment names contain numbers to distinguish between different experiments, e.g. 'T1', 'Test2', '3t'? If yes, you can use the function 'CONTAINSSTRING' with Switch to create a calculated column.&lt;/P&gt;
&lt;P&gt;If there are no logic to follow, can you give some examples?&lt;/P&gt;</description>
      <pubDate>Thu, 09 May 2024 05:12:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Difference-between-Rows-for-a-given-Measure/m-p/3901538#M152035</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-05-09T05:12:00Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Difference between Rows for a given Measure</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Difference-between-Rows-for-a-given-Measure/m-p/3913846#M152377</link>
      <description>&lt;P&gt;Hi Anonymous&lt;/a&gt; thanks for your suggestion and my apologies for my late reply. It seems like I have gone back and had a look at my data. We have decided to narrow down the list of the strings contained in the "Experiment Name" field to those that have a consistent naming format, and thus I think your solution should indeed work. Thanks again for your support!&lt;/P&gt;</description>
      <pubDate>Mon, 13 May 2024 11:48:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Difference-between-Rows-for-a-given-Measure/m-p/3913846#M152377</guid>
      <dc:creator>kulpushu</dc:creator>
      <dc:date>2024-05-13T11:48:40Z</dc:date>
    </item>
  </channel>
</rss>

