<?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: Calculating the percentage of a category total (not the grand total) on a bar chart in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-the-percentage-of-a-category-total-not-the-grand/m-p/4066777#M161443</link>
    <description>&lt;P&gt;Thank you for this. I am not able to replicate this solution as my data is spread across different queries. I have had to use Rank tables for the grade bands, because Power BI doesn't provide an easy way to sort them, and my equivalent of your Value columnn is a count based on a measure - so it's not behaving the same way and I'm not able to pull in the things from the different queries in the same way.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It may be possible to replicate it with better coding knowledge than I have, but I haven't yet managed to work it out!&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 29 Jul 2024 10:05:34 GMT</pubDate>
    <dc:creator>HM615</dc:creator>
    <dc:date>2024-07-29T10:05:34Z</dc:date>
    <item>
      <title>Calculating the percentage of a category total (not the grand total) on a bar chart</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-the-percentage-of-a-category-total-not-the-grand/m-p/4032377#M159521</link>
      <description>&lt;P&gt;I have a chart showing the number of people who fall in a particular banding each year:&amp;nbsp;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I want to show the figure as a percentage of the total &lt;EM&gt;for that year&lt;/EM&gt;. If I chose the 'show as percentage of grand total' option in formatting, it shows me the number as a percentage of the overall total, rather than the total for each year. I have tried the following:&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Stu % = &lt;/SPAN&gt;&lt;SPAN&gt;DIVIDE&lt;/SPAN&gt;&lt;SPAN&gt;([Stu Count],&lt;/SPAN&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;([Stu Count],&lt;/SPAN&gt;&lt;SPAN&gt;ALL&lt;/SPAN&gt;&lt;SPAN&gt;('Tariff Query'[cap_ayrc])), &lt;/SPAN&gt;&lt;SPAN&gt;BLANK&lt;/SPAN&gt;&lt;SPAN&gt;())&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;but it doesn't work. I think it's showing me the percentage of the total for each band, rather than each year (so e.g. the AAA+ category adds up to 100%, the AAB category adds up to 100% - where I want the different bands for each year to total 100%):&amp;nbsp;&lt;img /&gt;&lt;P&gt;Does anyone have any suggestions?&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 09 Jul 2024 10:34:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-the-percentage-of-a-category-total-not-the-grand/m-p/4032377#M159521</guid>
      <dc:creator>HM615</dc:creator>
      <dc:date>2024-07-09T10:34:13Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating the percentage of a category total (not the grand total) on a bar chart</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-the-percentage-of-a-category-total-not-the-grand/m-p/4033576#M159691</link>
      <description>&lt;P&gt;Hi&amp;nbsp; &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="681921" data-lia-user-login="HM615" class="lia-mention lia-mention-user"&gt;HM615&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;I created some data:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here are the steps you can follow：&lt;/P&gt;
&lt;P&gt;1. Create measure.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Measure =
var _yearvalue=
SUMX(
    FILTER(ALL('Tariff Query'),'Tariff Query'[Group]=MAX('Tariff Query'[Group])&amp;amp;&amp;amp;'Tariff Query'[Year]=MAX('Tariff Query'[Year])),[Value])
var _groupvalue=
SUMX(
    FILTER(ALL('Tariff Query'),'Tariff Query'[Year]=MAX('Tariff Query'[Year])),[Value])
RETURN
DIVIDE(
    _yearvalue,_groupvalue)&lt;/LI-CODE&gt;
&lt;P&gt;2. Result:&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;/P&gt;
&lt;P&gt;Liu Yang&lt;/P&gt;
&lt;P&gt;If this post &lt;STRONG&gt;helps&lt;/STRONG&gt;, then please consider &lt;EM&gt;Accept it as the solution&lt;/EM&gt; to help the other members find it more quickly&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jul 2024 03:17:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-the-percentage-of-a-category-total-not-the-grand/m-p/4033576#M159691</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-07-10T03:17:57Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating the percentage of a category total (not the grand total) on a bar chart</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-the-percentage-of-a-category-total-not-the-grand/m-p/4066777#M161443</link>
      <description>&lt;P&gt;Thank you for this. I am not able to replicate this solution as my data is spread across different queries. I have had to use Rank tables for the grade bands, because Power BI doesn't provide an easy way to sort them, and my equivalent of your Value columnn is a count based on a measure - so it's not behaving the same way and I'm not able to pull in the things from the different queries in the same way.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It may be possible to replicate it with better coding knowledge than I have, but I haven't yet managed to work it out!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jul 2024 10:05:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Calculating-the-percentage-of-a-category-total-not-the-grand/m-p/4066777#M161443</guid>
      <dc:creator>HM615</dc:creator>
      <dc:date>2024-07-29T10:05:34Z</dc:date>
    </item>
  </channel>
</rss>

