<?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: Help calculating percentage of total in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-calculating-percentage-of-total/m-p/4266972#M169151</link>
    <description>&lt;P&gt;Use Perfomance Analyzer to get the DAX code for the query for the table visual and post the query here. That will tell us any other filters which are being applied and which would affect the calculation.&lt;/P&gt;</description>
    <pubDate>Fri, 01 Nov 2024 13:31:31 GMT</pubDate>
    <dc:creator>johnt75</dc:creator>
    <dc:date>2024-11-01T13:31:31Z</dc:date>
    <item>
      <title>Help calculating percentage of total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-calculating-percentage-of-total/m-p/4266656#M169118</link>
      <description>&lt;P&gt;Hi, I'm really not good with DAX/measures etc, and I'm sure what I want to do is probably pretty simple, but I can't figure it out!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is a snip of the dataset I'm working with (it's open source data from the Home Office in the UK):&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;In the final column that's highlighed is the volume of outcomes. Three columns before that is the Outcome Group, which has 22 different outcomes. There are multiple police forces in the dataset, and several financial quarters. The percentage will only make sense for a single police force for a single quarter. When I use slicers to select a force, and a quarter, I want to be able to display what percentage of the total outcomes, each Outcome Group was.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What formula should I use, please?&lt;/P&gt;</description>
      <pubDate>Fri, 01 Nov 2024 08:56:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-calculating-percentage-of-total/m-p/4266656#M169118</guid>
      <dc:creator>JennaExe</dc:creator>
      <dc:date>2024-11-01T08:56:21Z</dc:date>
    </item>
    <item>
      <title>Re: Help calculating percentage of total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-calculating-percentage-of-total/m-p/4266735#M169125</link>
      <description>&lt;P&gt;Try&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;% of Total =
IF (
    HASONEVALUE ( 'Table'[Date] ) &amp;amp;&amp;amp; HASONEVALUE ( 'Table'[Force Name] ),
    VAR CurrentOutcomes =
        SUM ( 'Table'[Outcomes for inv] )
    VAR TotalOutcomes =
        CALCULATE (
            SUM ( 'Table'[Outcomes for inv] ),
            ALLEXCEPT ( 'Table', 'Tabbe'[Date], 'Table'[Force Name] )
        )
    VAR Result =
        DIVIDE ( CurrentOutcomes, TotalOutcomes )
    RETURN
        Result
)
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Nov 2024 09:53:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-calculating-percentage-of-total/m-p/4266735#M169125</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2024-11-01T09:53:26Z</dc:date>
    </item>
    <item>
      <title>Re: Help calculating percentage of total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-calculating-percentage-of-total/m-p/4266755#M169129</link>
      <description>&lt;P&gt;Hi, thanks so much for helping... it doesn't seem to be doing what it should, as it's producing very low percentages and if it's working it should always be out of 100% total... Any suggestions?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Nov 2024 10:07:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-calculating-percentage-of-total/m-p/4266755#M169129</guid>
      <dc:creator>JennaExe</dc:creator>
      <dc:date>2024-11-01T10:07:52Z</dc:date>
    </item>
    <item>
      <title>Re: Help calculating percentage of total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-calculating-percentage-of-total/m-p/4266852#M169134</link>
      <description>&lt;P&gt;Can you share the PBIX? You could upload it to Google Drive or OneDrive or something.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Nov 2024 11:47:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-calculating-percentage-of-total/m-p/4266852#M169134</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2024-11-01T11:47:17Z</dc:date>
    </item>
    <item>
      <title>Re: Help calculating percentage of total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-calculating-percentage-of-total/m-p/4266887#M169139</link>
      <description>&lt;P&gt;Ah no, sorry, can't do that as there's other data in there which is sensitive and can't be shared &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Nov 2024 12:27:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-calculating-percentage-of-total/m-p/4266887#M169139</guid>
      <dc:creator>JennaExe</dc:creator>
      <dc:date>2024-11-01T12:27:15Z</dc:date>
    </item>
    <item>
      <title>Re: Help calculating percentage of total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-calculating-percentage-of-total/m-p/4266972#M169151</link>
      <description>&lt;P&gt;Use Perfomance Analyzer to get the DAX code for the query for the table visual and post the query here. That will tell us any other filters which are being applied and which would affect the calculation.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Nov 2024 13:31:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-calculating-percentage-of-total/m-p/4266972#M169151</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2024-11-01T13:31:31Z</dc:date>
    </item>
    <item>
      <title>Re: Help calculating percentage of total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-calculating-percentage-of-total/m-p/4267010#M169154</link>
      <description>&lt;P&gt;Further to the above, I think the formula you gave me is working to some extent... I tried putting a table on a blank page with no filters, and the formula works if the table contains both the force name and the quarter date:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, when I try to use the measure in a graph, it isn't showing the correct percentage. In this image, I have a matrix table which I've set to show percentages, which are correct, but the graph using my new measure (I only want to display percentage of Charges) is underneath with incorrect percentages:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Nov 2024 13:51:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-calculating-percentage-of-total/m-p/4267010#M169154</guid>
      <dc:creator>JennaExe</dc:creator>
      <dc:date>2024-11-01T13:51:43Z</dc:date>
    </item>
    <item>
      <title>Re: Help calculating percentage of total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-calculating-percentage-of-total/m-p/4268564#M169239</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="465819" data-lia-user-login="JennaExe" class="lia-mention lia-mention-user"&gt;JennaExe&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I did some change on&amp;nbsp;johnt75's dax, please try this:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;% of Total =
VAR _CurrentDate =
    SELECTEDVALUE ( 'Tabbe'[Date] )
VAR _currentForce =
    SELECTEDVALUE ( 'Table'[Force Name] )
RETURN
    IF (
        HASONEVALUE ( 'Table'[Date] ) &amp;amp;&amp;amp; HASONEVALUE ( 'Table'[Force Name] ),
        VAR CurrentOutcomes =
            SUM ( 'Table'[Outcomes for inv] )
        VAR TotalOutcomes =
            CALCULATE (
                SUM ( 'Table'[Outcomes for inv] ),
                FILTER (
                    ALLSELECTED ( 'Table' ),
                    'Tabbe'[Date] = _CurrentDate
                        &amp;amp;&amp;amp; 'Table'[Force Name] = _currentForce
                )
            )
        VAR Result =
            DIVIDE ( CurrentOutcomes, TotalOutcomes )
        RETURN
            Result
    )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this can help,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards&lt;/P&gt;
&lt;P&gt;Zhengdong Xu&lt;BR /&gt;If this post&amp;nbsp;&lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&lt;EM&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Nov 2024 05:24:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-calculating-percentage-of-total/m-p/4268564#M169239</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-11-04T05:24:23Z</dc:date>
    </item>
    <item>
      <title>Re: Help calculating percentage of total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-calculating-percentage-of-total/m-p/4268739#M169249</link>
      <description>&lt;P&gt;Hello, thanks for your post. Not sure if that's a solution (I'm assuming there are multiple ways to achieve the same result?), but over the weekend I asked ChatGPT for some help and have come up with the following formula which is working as I want it to:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;OutcomePercentage =&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;DIVIDE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;SUM&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Police Outcomes'&lt;/SPAN&gt;&lt;SPAN&gt;[Outcomes for investigations closed in the quarter]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;SUM&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Police Outcomes'&lt;/SPAN&gt;&lt;SPAN&gt;[Outcomes for investigations closed in the quarter]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;REMOVEFILTERS&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Police Outcomes'&lt;/SPAN&gt;&lt;SPAN&gt;[Outcome Group]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;VALUES&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Police Outcomes'&lt;/SPAN&gt;&lt;SPAN&gt;[Force Name]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;VALUES&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Police Outcomes'&lt;/SPAN&gt;&lt;SPAN&gt;[Date]&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 04 Nov 2024 07:53:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Help-calculating-percentage-of-total/m-p/4268739#M169249</guid>
      <dc:creator>JennaExe</dc:creator>
      <dc:date>2024-11-04T07:53:32Z</dc:date>
    </item>
  </channel>
</rss>

