<?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: Divide total of a column by unique value depending on group in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Divide-total-of-a-column-by-unique-value-depending-on-group/m-p/2124142#M48711</link>
    <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="331224" data-lia-user-login="Velvetine" class="lia-mention lia-mention-user"&gt;Velvetine&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;that is possible by modifying the filter context for the total-part. This you can do with the CALCULATE function in combination with the ALL function.&lt;/P&gt;
&lt;P&gt;This should do it:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Percentage =
-- you can get the total by removing all filter context
-- with the ALL function. The result you can save in a variable
VAR vTotal =
    CALCULATE(
        SUM( Orders[Sales] ),
        ALL( Orders )
    )
RETURN
-- Then you divide the value of the current filter context by the total
    DIVIDE(
        SUM( Orders[Sales] ),
        vTotal
    )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you don't like to work with variables (what I would recommend to get used to it), you could also put everything in one statement:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Percentage =
DIVIDE(
    SUM( Orders[Sales] ),
    CALCULATE(
        SUM( Orders[Sales] ),
        ALL( Orders )
    )
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV&gt;If you need any help please let me know.&lt;/DIV&gt;
&lt;DIV&gt;If I answered your question I would be happy if you could mark my post as a solution &lt;span class="lia-unicode-emoji" title=":heavy_check_mark:"&gt;✔️&lt;/span&gt; and give it a thumbs up &lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;Best regards&lt;/DIV&gt;
&lt;DIV&gt;Denis&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;Blog: &lt;A title="Click here!" href="https://whatthefact.bi/?utm_source=powerbicommunity&amp;amp;utm_medium=link&amp;amp;utm_campaign=forum" target="_blank" rel="noopener"&gt;&lt;U&gt;WhatTheFact.bi&lt;/U&gt;&lt;/A&gt;&lt;/DIV&gt;
&lt;DIV&gt;Follow me: &lt;A title="Click here!" href="https://twitter.com/DenSelimovic" target="_blank" rel="noopener"&gt;&lt;U&gt;twitter.com/DenSelimovic&lt;/U&gt;&lt;/A&gt;&lt;/DIV&gt;</description>
    <pubDate>Fri, 08 Oct 2021 12:44:42 GMT</pubDate>
    <dc:creator>selimovd</dc:creator>
    <dc:date>2021-10-08T12:44:42Z</dc:date>
    <item>
      <title>Divide total of a column by unique value depending on group</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Divide-total-of-a-column-by-unique-value-depending-on-group/m-p/2123610#M48697</link>
      <description>&lt;P&gt;Hi guys,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Im quite new here really appreciate your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a Orders table comprise of Sales, Outlets, and Outlet_Size columns. I'm trying to calculate the rate, which is something like this DIVIDE(SUM(Orders[Sales],Sales[Outlet_Size]). But how do I write a query that can divide a total of all columns, to one single value depending on which outlet ?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Appreciate your help !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Fri, 08 Oct 2021 08:50:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Divide-total-of-a-column-by-unique-value-depending-on-group/m-p/2123610#M48697</guid>
      <dc:creator>Velvetine</dc:creator>
      <dc:date>2021-10-08T08:50:51Z</dc:date>
    </item>
    <item>
      <title>Re: Divide total of a column by unique value depending on group</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Divide-total-of-a-column-by-unique-value-depending-on-group/m-p/2124142#M48711</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="331224" data-lia-user-login="Velvetine" class="lia-mention lia-mention-user"&gt;Velvetine&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;that is possible by modifying the filter context for the total-part. This you can do with the CALCULATE function in combination with the ALL function.&lt;/P&gt;
&lt;P&gt;This should do it:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Percentage =
-- you can get the total by removing all filter context
-- with the ALL function. The result you can save in a variable
VAR vTotal =
    CALCULATE(
        SUM( Orders[Sales] ),
        ALL( Orders )
    )
RETURN
-- Then you divide the value of the current filter context by the total
    DIVIDE(
        SUM( Orders[Sales] ),
        vTotal
    )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you don't like to work with variables (what I would recommend to get used to it), you could also put everything in one statement:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Percentage =
DIVIDE(
    SUM( Orders[Sales] ),
    CALCULATE(
        SUM( Orders[Sales] ),
        ALL( Orders )
    )
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV&gt;If you need any help please let me know.&lt;/DIV&gt;
&lt;DIV&gt;If I answered your question I would be happy if you could mark my post as a solution &lt;span class="lia-unicode-emoji" title=":heavy_check_mark:"&gt;✔️&lt;/span&gt; and give it a thumbs up &lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;Best regards&lt;/DIV&gt;
&lt;DIV&gt;Denis&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;Blog: &lt;A title="Click here!" href="https://whatthefact.bi/?utm_source=powerbicommunity&amp;amp;utm_medium=link&amp;amp;utm_campaign=forum" target="_blank" rel="noopener"&gt;&lt;U&gt;WhatTheFact.bi&lt;/U&gt;&lt;/A&gt;&lt;/DIV&gt;
&lt;DIV&gt;Follow me: &lt;A title="Click here!" href="https://twitter.com/DenSelimovic" target="_blank" rel="noopener"&gt;&lt;U&gt;twitter.com/DenSelimovic&lt;/U&gt;&lt;/A&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 08 Oct 2021 12:44:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Divide-total-of-a-column-by-unique-value-depending-on-group/m-p/2124142#M48711</guid>
      <dc:creator>selimovd</dc:creator>
      <dc:date>2021-10-08T12:44:42Z</dc:date>
    </item>
  </channel>
</rss>

