<?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: Percentages based of subtotals of a matrix in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Percentages-based-of-subtotals-of-a-matrix/m-p/3563410#M137360</link>
    <description>&lt;P&gt;Thanks for the answer &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="343431" data-lia-user-login="ValtteriN" class="lia-mention lia-mention-user"&gt;ValtteriN&lt;/a&gt;&amp;nbsp;! I think I'm close to the outcome but I still have some issues.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is a more detailed query&amp;nbsp;&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;%percentage = 
VAR nb_client = SUM(mytable[total_clients_this_year]) RETURN
SWITCH(TRUE(),
ISFILTERED(mytable[ZONE D]), nb_client/CALCULATE(SUM(mytable[total_clients_this_year]), ALL(mytable[ZONE D])),
ISFILTERED(other_table[ZONE C]), nb_client/CALCULATE(SUM(mytable[total_clients_this_year]), ALL(other_table[ZONE C])),
ISFILTERED(other_table[ZONE B]), nb_client/CALCULATE(SUM(mytable[total_clients_this_year]), ALL(other_table[ZONE B])),

 nb_client/CALCULATE(SUM(mytable[YTD]), ALLSELECTED())) --ALL SELECTED because there might be filters on the page to apply here&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't think there should be an issue but you can see that some of the columns i use are from 2 different tables.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;What happens is that I get the expected result at the lowest level (zone D) but all other level = 100 % ..&lt;/P&gt;&lt;P&gt;Thanks again !&lt;/P&gt;</description>
    <pubDate>Fri, 01 Dec 2023 16:10:55 GMT</pubDate>
    <dc:creator>StickyFingers78</dc:creator>
    <dc:date>2023-12-01T16:10:55Z</dc:date>
    <item>
      <title>Percentages based of subtotals of a matrix</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Percentages-based-of-subtotals-of-a-matrix/m-p/3562766#M137323</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am rather new to power BI and i didn't find a answer to what I'm trying to do.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Basically I have a matrix with a percentage column that depends on the grand total of a column.&lt;/P&gt;&lt;P&gt;What I'd like to do is that when I expand one level of that matrix, the percentages of the same column, instead of being calculated on the grand total (which look then very small) will now be based on the parent category which was expanded, to sum up to 100.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is a picture for explanation:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I would like the values in the red box to add up to 100% which would be the whole data represented by ZONE3 (which will still stay at 15.26%).&lt;/P&gt;&lt;P&gt;And even better If I can add one level more after to expand which will again add up to 100% then based on my SUBZONE level.&lt;BR /&gt;&lt;BR /&gt;THanks a lot for your help!&lt;/P&gt;</description>
      <pubDate>Fri, 01 Dec 2023 09:34:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Percentages-based-of-subtotals-of-a-matrix/m-p/3562766#M137323</guid>
      <dc:creator>StickyFingers78</dc:creator>
      <dc:date>2023-12-01T09:34:24Z</dc:date>
    </item>
    <item>
      <title>Re: Percentages based of subtotals of a matrix</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Percentages-based-of-subtotals-of-a-matrix/m-p/3563173#M137349</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;Here is one way to do this:&lt;BR /&gt;&lt;BR /&gt;Data:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Dax:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;Percentage =&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;_v&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;'Table (14)'&lt;/SPAN&gt;&lt;SPAN&gt;[Value]&lt;/SPAN&gt;&lt;SPAN&gt;) &lt;/SPAN&gt;&lt;SPAN&gt;return&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;BR /&gt;
&lt;DIV&gt;&lt;SPAN&gt;SWITCH&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;TRUE&lt;/SPAN&gt;&lt;SPAN&gt;(),&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;BR /&gt;
&lt;DIV&gt;&lt;SPAN&gt;ISFILTERED&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Table (14)'&lt;/SPAN&gt;&lt;SPAN&gt;[DimC]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;SPAN&gt;_v&lt;/SPAN&gt;&lt;SPAN&gt;/&lt;/SPAN&gt;&lt;SPAN&gt;CALCULATE&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;'Table (14)'&lt;/SPAN&gt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;SPAN&gt;'Table (14)'&lt;/SPAN&gt;&lt;SPAN&gt;[Value]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;SPAN&gt;ALL&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'Table (14)'&lt;/SPAN&gt;&lt;SPAN&gt;)))&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;End result:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;I hope this post helps to solve your issue and if it does consider accepting it as a solution and giving the post a thumbs up!&lt;BR /&gt;&lt;BR /&gt;My LinkedIn: &lt;A href="https://www.linkedin.com/in/n%C3%A4ttiahov-00001/" target="_blank"&gt;https://www.linkedin.com/in/n%C3%A4ttiahov-00001/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Dec 2023 13:50:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Percentages-based-of-subtotals-of-a-matrix/m-p/3563173#M137349</guid>
      <dc:creator>ValtteriN</dc:creator>
      <dc:date>2023-12-01T13:50:57Z</dc:date>
    </item>
    <item>
      <title>Re: Percentages based of subtotals of a matrix</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Percentages-based-of-subtotals-of-a-matrix/m-p/3563410#M137360</link>
      <description>&lt;P&gt;Thanks for the answer &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="343431" data-lia-user-login="ValtteriN" class="lia-mention lia-mention-user"&gt;ValtteriN&lt;/a&gt;&amp;nbsp;! I think I'm close to the outcome but I still have some issues.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is a more detailed query&amp;nbsp;&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;%percentage = 
VAR nb_client = SUM(mytable[total_clients_this_year]) RETURN
SWITCH(TRUE(),
ISFILTERED(mytable[ZONE D]), nb_client/CALCULATE(SUM(mytable[total_clients_this_year]), ALL(mytable[ZONE D])),
ISFILTERED(other_table[ZONE C]), nb_client/CALCULATE(SUM(mytable[total_clients_this_year]), ALL(other_table[ZONE C])),
ISFILTERED(other_table[ZONE B]), nb_client/CALCULATE(SUM(mytable[total_clients_this_year]), ALL(other_table[ZONE B])),

 nb_client/CALCULATE(SUM(mytable[YTD]), ALLSELECTED())) --ALL SELECTED because there might be filters on the page to apply here&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't think there should be an issue but you can see that some of the columns i use are from 2 different tables.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;What happens is that I get the expected result at the lowest level (zone D) but all other level = 100 % ..&lt;/P&gt;&lt;P&gt;Thanks again !&lt;/P&gt;</description>
      <pubDate>Fri, 01 Dec 2023 16:10:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Percentages-based-of-subtotals-of-a-matrix/m-p/3563410#M137360</guid>
      <dc:creator>StickyFingers78</dc:creator>
      <dc:date>2023-12-01T16:10:55Z</dc:date>
    </item>
  </channel>
</rss>

