<?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 Percentage difference between two columns and grouping on state in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Percentage-difference-between-two-columns-and-grouping/m-p/2990353#M100594</link>
    <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="491423" data-lia-user-login="Saideep16" class="lia-mention lia-mention-user"&gt;Saideep16&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The description is not that clear. It would save a lot of effort if you could:&lt;/P&gt;&lt;P&gt;1) fill out the expected result column&lt;/P&gt;&lt;P&gt;2) indicate which headers are column and which are measures.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 27 Dec 2022 15:17:16 GMT</pubDate>
    <dc:creator>FreemanZ</dc:creator>
    <dc:date>2022-12-27T15:17:16Z</dc:date>
    <item>
      <title>Calculate Percentage difference between two columns and grouping on state</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Percentage-difference-between-two-columns-and-grouping/m-p/2989910#M100545</link>
      <description>&lt;P&gt;Hi Everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance for all who tried to help me!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am looking for a measure to calculate percentage difference between two columns (Prev cnt, Curr cnt).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;FYI, currently my measure calculating percentage difference 100% for overall count for all states or stateid.&lt;/P&gt;&lt;PRE&gt;DIVIDE ( [prev cnt], [curr cnt] )&lt;/PRE&gt;&lt;P&gt;But I need percentage as below:&lt;/P&gt;&lt;P&gt;example:&lt;/P&gt;&lt;P&gt;For state 'GA' and Stateid&amp;nbsp; there are four records you see below, I need to calculate 100% for those four records (GA: 4 records by 100%)&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then next state 'CA' which has three records for that next 100% has to divide for those three records.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Same goes for next states.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need DAX to calculate 'previous cnt' and 'current cnt' column percentage difference individually for each state.&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;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Dec 2022 15:44:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Percentage-difference-between-two-columns-and-grouping/m-p/2989910#M100545</guid>
      <dc:creator>Saideep16</dc:creator>
      <dc:date>2022-12-27T15:44:44Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Percentage difference between two columns and grouping on state</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Percentage-difference-between-two-columns-and-grouping/m-p/2990093#M100566</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="491423" data-lia-user-login="Saideep16" class="lia-mention lia-mention-user"&gt;Saideep16&lt;/a&gt; , refer if offset can help &lt;/P&gt;
&lt;P&gt;Power BI Offset Compare Categories, Time Intelligence MOM, QOQ, and YOY: &lt;A href="https://youtu.be/5YMlkDNGr0U" target="_blank"&gt;https://youtu.be/5YMlkDNGr0U&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Dec 2022 11:56:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Percentage-difference-between-two-columns-and-grouping/m-p/2990093#M100566</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2022-12-27T11:56:51Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Percentage difference between two columns and grouping on state</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Percentage-difference-between-two-columns-and-grouping/m-p/2990353#M100594</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="491423" data-lia-user-login="Saideep16" class="lia-mention lia-mention-user"&gt;Saideep16&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The description is not that clear. It would save a lot of effort if you could:&lt;/P&gt;&lt;P&gt;1) fill out the expected result column&lt;/P&gt;&lt;P&gt;2) indicate which headers are column and which are measures.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Dec 2022 15:17:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Percentage-difference-between-two-columns-and-grouping/m-p/2990353#M100594</guid>
      <dc:creator>FreemanZ</dc:creator>
      <dc:date>2022-12-27T15:17:16Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Percentage difference between two columns and grouping on state</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Percentage-difference-between-two-columns-and-grouping/m-p/2990420#M100599</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="491423" data-lia-user-login="Saideep16" class="lia-mention lia-mention-user"&gt;Saideep16&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;please try&lt;/P&gt;
&lt;P&gt;PERCENTAGE =&lt;BR /&gt;DIVIDE (&lt;BR /&gt;'Table'[DIFF CNT],&lt;BR /&gt;CALCULATE ( SUM ( 'Table'[DIFF CNT] ), ALLEXCEPT ( 'Table', 'Table'[STATE] ) )&lt;BR /&gt;)&lt;/P&gt;</description>
      <pubDate>Tue, 27 Dec 2022 16:18:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Percentage-difference-between-two-columns-and-grouping/m-p/2990420#M100599</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-12-27T16:18:00Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate Percentage difference between two columns and grouping on state</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Percentage-difference-between-two-columns-and-grouping/m-p/2990832#M100616</link>
      <description>&lt;P&gt;The output you are expecting for each row is not clear. Also, you did not mention whether DIFF CNT is a measure or a column!.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Assuming, DIFF CNT is a column, let us say the TableState data is below:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Percentage measure:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;PERCENTAGE = 
VAR _currState = SELECTEDVALUE(TableState[STATE])
var _prev = sumx(TableState, TableState[PREV CNT])
var _curr = sumx(TableState, TableState[CURR CNT])
var _curr1 = CALCULATE( sum(TableState[CURR CNT]), FILTER(all(TableState), TableState[STATE] = _currState))
var _prev1 = CALCULATE( sum(TableState[PREV CNT]), FILTER(all(TableState), TableState[STATE] = _currState))

return if (HASONEFILTER(TableState[STATE]), (_prev / _curr1) ,  (_prev / _curr ) )&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;Output:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Adjust the formula to your needs!&lt;/P&gt;</description>
      <pubDate>Tue, 27 Dec 2022 23:40:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculate-Percentage-difference-between-two-columns-and-grouping/m-p/2990832#M100616</guid>
      <dc:creator>sevenhills</dc:creator>
      <dc:date>2022-12-27T23:40:10Z</dc:date>
    </item>
  </channel>
</rss>

