<?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: DAX measure for percentage share in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-measure-for-percentage-share/m-p/4088358#M162265</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Thank you very much for your message, and I am not sure where the country is coming from.&lt;/P&gt;
&lt;P&gt;Perhaps, you can try to replace ALL with ALLSELECTED DAX function.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/dax/allselected-function-dax?wt.mc_id=DP-MVP-5004989" target="_blank"&gt;ALLSELECTED function (DAX) - DAX | Microsoft Learn&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;share: =
VAR _employee = [employee:]
RETURN
    SWITCH (
        TRUE (),
        ISINSCOPE ( location[location] ) &amp;amp;&amp;amp; ISINSCOPE ( division[division] )
            || ISINSCOPE ( location[location] ),
            DIVIDE (
                _employee,
                CALCULATE ( [employee:], ALLSELECTED ( division[division] ) )
            ),
        DIVIDE ( _employee, CALCULATE ( [employee:], ALLSELECTED () ) )
    )
&lt;/LI-CODE&gt;</description>
    <pubDate>Thu, 08 Aug 2024 05:47:36 GMT</pubDate>
    <dc:creator>Jihwan_Kim</dc:creator>
    <dc:date>2024-08-08T05:47:36Z</dc:date>
    <item>
      <title>DAX measure for percentage share</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-measure-for-percentage-share/m-p/4086164#M162179</link>
      <description>&lt;P&gt;Hi together,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a simple example where I need to calculate the percentage share based on different aggregation levels but I don't know how to do this with a DAX Measure.&lt;BR /&gt;The data looks like this:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;The first table in the top is the initial data. In one location is a division, for example manufacturing, and has a certain number of employees.&lt;BR /&gt;I would like to calculate&lt;BR /&gt;1. The percentage of employees for each division and each location (see left table)&lt;/P&gt;&lt;P&gt;2. The percentage of employees for all divisions at all locations (see right table)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Could any one tell me, how to write this within a DAX-Measure?&lt;BR /&gt;&lt;BR /&gt;Thank you in advance.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Andreas&lt;/P&gt;</description>
      <pubDate>Wed, 07 Aug 2024 07:34:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-measure-for-percentage-share/m-p/4086164#M162179</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-08-07T07:34:10Z</dc:date>
    </item>
    <item>
      <title>Re: DAX measure for percentage share</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-measure-for-percentage-share/m-p/4086275#M162186</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I am not sure how your semantic model looks like, but I tried to create a sample pbix file like below.&lt;/P&gt;
&lt;P&gt;Please check the below picture and the attached pbix file.&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;&lt;img /&gt;&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;share: = 
VAR _employee = [employee:]
RETURN
    SWITCH (
        TRUE (),
        ISINSCOPE ( location[location] ) &amp;amp;&amp;amp; ISINSCOPE ( division[division] )
            || ISINSCOPE ( location[location] ), DIVIDE ( _employee, CALCULATE ( [employee:], ALL ( division[division] ) ) ),
        DIVIDE ( _employee, CALCULATE ( [employee:], ALL () ) )
    )&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;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Aug 2024 08:19:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-measure-for-percentage-share/m-p/4086275#M162186</guid>
      <dc:creator>Jihwan_Kim</dc:creator>
      <dc:date>2024-08-07T08:19:44Z</dc:date>
    </item>
    <item>
      <title>Re: DAX measure for percentage share</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-measure-for-percentage-share/m-p/4086683#M162211</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="291628" data-lia-user-login="Jihwan_Kim" class="lia-mention lia-mention-user"&gt;Jihwan_Kim&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you for your support. I have the same data model as you provided.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;It's almost working.&lt;BR /&gt;&lt;BR /&gt;Unfortunately I have the use-case that I need to pre-filter the report for some specific user groups.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;So the table location has the column country inside and there is the prefilter on:&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;So the issue with that is that the 100 % level is shifting, depending on the filtered country.&lt;BR /&gt;&lt;BR /&gt;Is there a way how to consider this filter within the measures? (So that each filtered country is considered as 100 %)&lt;BR /&gt;&lt;BR /&gt;Thanks again.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Andreas&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Aug 2024 12:10:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-measure-for-percentage-share/m-p/4086683#M162211</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-08-07T12:10:10Z</dc:date>
    </item>
    <item>
      <title>Re: DAX measure for percentage share</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-measure-for-percentage-share/m-p/4088358#M162265</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Thank you very much for your message, and I am not sure where the country is coming from.&lt;/P&gt;
&lt;P&gt;Perhaps, you can try to replace ALL with ALLSELECTED DAX function.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/dax/allselected-function-dax?wt.mc_id=DP-MVP-5004989" target="_blank"&gt;ALLSELECTED function (DAX) - DAX | Microsoft Learn&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;share: =
VAR _employee = [employee:]
RETURN
    SWITCH (
        TRUE (),
        ISINSCOPE ( location[location] ) &amp;amp;&amp;amp; ISINSCOPE ( division[division] )
            || ISINSCOPE ( location[location] ),
            DIVIDE (
                _employee,
                CALCULATE ( [employee:], ALLSELECTED ( division[division] ) )
            ),
        DIVIDE ( _employee, CALCULATE ( [employee:], ALLSELECTED () ) )
    )
&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 08 Aug 2024 05:47:36 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-measure-for-percentage-share/m-p/4088358#M162265</guid>
      <dc:creator>Jihwan_Kim</dc:creator>
      <dc:date>2024-08-08T05:47:36Z</dc:date>
    </item>
    <item>
      <title>Re: DAX measure for percentage share</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-measure-for-percentage-share/m-p/4088862#M162275</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for Jihwan_Kim's concern about this issue.&lt;/P&gt;
&lt;P&gt;His idea of a solution that I agree with.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'd like to ask:&lt;/P&gt;
&lt;P&gt;&lt;SPAN data-contrast="auto"&gt;What exactly does your semantic model look like?&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN data-contrast="auto"&gt;What are your form fields like? What kind of results are you looking for in the end?&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN data-contrast="auto"&gt;I added the Country field and a few rows of data to the dataset based on the solution provided by Jihwan_Kim, but I'm not sure if it's consistent with the structure of your dataset:&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN data-contrast="auto"&gt;Perhaps you need to create another new Measure to perform the calculations:&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&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;LI-CODE lang="markup"&gt;share1 = 
VAR _employee = [employee:]
RETURN
    SWITCH (
        TRUE (),
        ISINSCOPE ( location[location] ) &amp;amp;&amp;amp; ISINSCOPE ( division[division] ),
            DIVIDE (
                _employee,
                CALCULATE ( [employee:], ALLSELECTED ( division[division] ) )
            ),
        ISINSCOPE ( location[location] ),
            DIVIDE (
                _employee,
                CALCULATE ( [employee:], ALLSELECTED ( location[location] ) )
            ),
        DIVIDE ( _employee, CALCULATE ( [employee:], ALLSELECTED () ) )
    )
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN data-contrast="auto"&gt;Choose a different Measure in a different visual, here is my test result:&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&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;&lt;SPAN data-contrast="auto"&gt;If the above one can't help you get the desired result, please provide some &lt;STRONG&gt;sample data&lt;/STRONG&gt; in your tables (&lt;STRONG&gt;exclude sensitive data&lt;/STRONG&gt;) with Text format and your &lt;STRONG&gt;expected result&lt;/STRONG&gt; with backend logic and &lt;STRONG&gt;special examples&lt;/STRONG&gt;. It is better if you can share a simplified&amp;nbsp;&lt;STRONG&gt;pbix&amp;nbsp;file&lt;/STRONG&gt;. Thank you.&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.&lt;BR /&gt;Best Regards,&lt;BR /&gt;Fen Ling,&lt;BR /&gt;If this post &lt;EM&gt;&lt;STRONG&gt;helps&lt;/STRONG&gt;&lt;/EM&gt;, then please consider &lt;EM&gt;&lt;STRONG&gt;Accept it as the solution&lt;/STRONG&gt;&lt;/EM&gt; to help the other members find it more quickly.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Aug 2024 07:47:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-measure-for-percentage-share/m-p/4088862#M162275</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-08-13T07:47:27Z</dc:date>
    </item>
  </channel>
</rss>

