<?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 formula - calculate market share, compatible with filters and in charts showing categories in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-calculate-market-share-compatible-with-filters-and/m-p/4259017#M168752</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;for a filtered company - show market share by post code, by price band etc &lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you filter for a company in the same table then you will only get the data for that company, resulting in 100% market share.&amp;nbsp; Please be more explicit in what you expect to see - Do you want to compare the selected company against all other companies?&lt;/P&gt;</description>
    <pubDate>Sat, 26 Oct 2024 13:37:51 GMT</pubDate>
    <dc:creator>lbendlin</dc:creator>
    <dc:date>2024-10-26T13:37:51Z</dc:date>
    <item>
      <title>DAX formula - calculate market share, compatible with filters and in charts showing categories</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-calculate-market-share-compatible-with-filters-and/m-p/4258249#M168720</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;I'm trying to calculate a field for Company Market Share, that can be put into visuals and filtered bby category.&lt;/P&gt;&lt;P&gt;See sample data attached (link below).&lt;/P&gt;&lt;P&gt;I'd like to have a formula that can be used in a chart, and for a filtered company - show market share by post code, by price band etc&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've been using bthe fomula below, but its throwing out incorrect values ?&lt;/P&gt;&lt;DIV&gt;&l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;SPAN&gt;AllVolume&lt;/SPAN&gt;&lt;SPAN&gt; )&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.dropbox.com/scl/fi/yrlgyw929d250g5zbmfdt/sample-data.xlsx?rlkey=b8tv3vg4717ea85fckj2q9a16&amp;amp;st=6mfzoz3p&amp;amp;dl=0" target="_blank"&gt;https://www.dropbox.com/scl/fi/yrlgyw929d250g5zbmfdt/sample-data.xlsx?rlkey=b8tv3vg4717ea85fckj2q9a16&amp;amp;st=6mfzoz3p&amp;amp;dl=0&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks in advance for any help you can give !&lt;/P&gt;&lt;P&gt;dp_75&lt;/P&gt;</description>
      <pubDate>Fri, 25 Oct 2024 14:27:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-calculate-market-share-compatible-with-filters-and/m-p/4258249#M168720</guid>
      <dc:creator>dp_75</dc:creator>
      <dc:date>2024-10-25T14:27:51Z</dc:date>
    </item>
    <item>
      <title>Re: DAX formula - calculate market share, compatible with filters and in charts showing categories</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-calculate-market-share-compatible-with-filters-and/m-p/4258647#M168736</link>
      <description>&lt;P&gt;For most scenarios you can use implicit measures&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Or you can use ALLSELECTED&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;</description>
      <pubDate>Fri, 25 Oct 2024 22:05:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-calculate-market-share-compatible-with-filters-and/m-p/4258647#M168736</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-10-25T22:05:32Z</dc:date>
    </item>
    <item>
      <title>Re: DAX formula - calculate market share, compatible with filters and in charts showing categories</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-calculate-market-share-compatible-with-filters-and/m-p/4258874#M168750</link>
      <description>&lt;P&gt;Thanks Ibendlin,&lt;/P&gt;&lt;P&gt;If you have a filter for companyh on the page those methods don;t appear tp bring back the correct answers - see pic below.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Any ideas for fixing this ?&lt;/P&gt;&lt;P&gt;Many thanks&lt;/P&gt;&lt;P&gt;dp_75&lt;/P&gt;</description>
      <pubDate>Sat, 26 Oct 2024 08:10:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-calculate-market-share-compatible-with-filters-and/m-p/4258874#M168750</guid>
      <dc:creator>dp_75</dc:creator>
      <dc:date>2024-10-26T08:10:38Z</dc:date>
    </item>
    <item>
      <title>Re: DAX formula - calculate market share, compatible with filters and in charts showing categories</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-calculate-market-share-compatible-with-filters-and/m-p/4259017#M168752</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;for a filtered company - show market share by post code, by price band etc &lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you filter for a company in the same table then you will only get the data for that company, resulting in 100% market share.&amp;nbsp; Please be more explicit in what you expect to see - Do you want to compare the selected company against all other companies?&lt;/P&gt;</description>
      <pubDate>Sat, 26 Oct 2024 13:37:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-calculate-market-share-compatible-with-filters-and/m-p/4259017#M168752</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-10-26T13:37:51Z</dc:date>
    </item>
    <item>
      <title>Re: DAX formula - calculate market share, compatible with filters and in charts showing categories</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-calculate-market-share-compatible-with-filters-and/m-p/4262162#M168929</link>
      <description>&lt;P&gt;Hi Ibendlin, yes that's correct I'm trying to show the Market share of a company (relative to total all companies), by postcode, by price tier and otehr categories.&amp;nbsp; I have a filter on the page for the companyh in question (See pic i sent earleir in thread).&amp;nbsp; Do i need to create a DAX measure for this ?&amp;nbsp; or can it be done via the implicit measuires you suggested ?&amp;nbsp; Thanks again dp_75&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Oct 2024 11:28:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-calculate-market-share-compatible-with-filters-and/m-p/4262162#M168929</guid>
      <dc:creator>dp_75</dc:creator>
      <dc:date>2024-10-29T11:28:05Z</dc:date>
    </item>
    <item>
      <title>Re: DAX formula - calculate market share, compatible with filters and in charts showing categories</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-calculate-market-share-compatible-with-filters-and/m-p/4262992#M168965</link>
      <description>&lt;P&gt;Depends on what else is happening in your data model.&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;(relative to total all companies), by postcode, by price tier and otehr categories.  &lt;/LI-CODE&gt;
&lt;P&gt;Sounds like you want to REMOVEFILTERS on the company, but keep all other filters intact.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Oct 2024 00:11:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-calculate-market-share-compatible-with-filters-and/m-p/4262992#M168965</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-10-30T00:11:23Z</dc:date>
    </item>
    <item>
      <title>Re: DAX formula - calculate market share, compatible with filters and in charts showing categories</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-calculate-market-share-compatible-with-filters-and/m-p/4263733#M168994</link>
      <description>&lt;P&gt;Thanks for the reply ibendlin,&lt;/P&gt;&lt;P&gt;See the .pbix file in link below:&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.dropbox.com/scl/fi/zsev7d2tvqy1v8rmsmahh/241030-Sample.pbix?rlkey=eywsmypqmiyx75thoj8l1ga37&amp;amp;st=404e6xtf&amp;amp;dl=0" target="_blank"&gt;https://www.dropbox.com/scl/fi/zsev7d2tvqy1v8rmsmahh/241030-Sample.pbix?rlkey=eywsmypqmiyx75thoj8l1ga37&amp;amp;st=404e6xtf&amp;amp;dl=0&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The screen shot of Sheet 2 below shows the chart I am trying to show created using a % of Total. You can see the reported market share for company A as a % of all SW18 is incorrect in the chart - it should be 16.8%, not 11.6% as shown in the chart.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I think the problem is we are expressing a share of total as defined by filters and by the x-axis in the chart ?&amp;nbsp; Any ideas on how to fix this ?&lt;/P&gt;&lt;P&gt;Many thanks&lt;/P&gt;&lt;P&gt;dp_75&lt;/P&gt;</description>
      <pubDate>Wed, 30 Oct 2024 10:42:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-calculate-market-share-compatible-with-filters-and/m-p/4263733#M168994</guid>
      <dc:creator>dp_75</dc:creator>
      <dc:date>2024-10-30T10:42:43Z</dc:date>
    </item>
    <item>
      <title>Re: DAX formula - calculate market share, compatible with filters and in charts showing categories</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-calculate-market-share-compatible-with-filters-and/m-p/4266648#M169117</link>
      <description>&lt;P&gt;&lt;FONT&gt;&lt;FONT&gt;Thanks for the reply from lbendlin.&lt;BR /&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="826731" data-lia-user-login="dp_75" class="lia-mention lia-mention-user"&gt;dp_75&lt;/a&gt;&amp;nbsp;,&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;You can create a measure, as described by lbendlin, and use the REMOVEFILTERS function or the ALL function to remove the filter from the Company field to get the target result.&lt;/FONT&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Mktshare(%) = 
DIVIDE(
    SUM(Sheet1[Price]), ---Total price for the selected company
    CALCULATE(SUM(Sheet1[Price]),REMOVEFILTERS(Sheet1[Company])) --- Total price for all companies
    )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT&gt;The final result is as follows, hopefully it will meet your needs.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT&gt;Please see the attached pbix for reference.&lt;BR /&gt;&lt;BR /&gt;Best Regards,&lt;BR /&gt;Dengliang Li&lt;BR /&gt;&lt;BR /&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Nov 2024 08:48:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-calculate-market-share-compatible-with-filters-and/m-p/4266648#M169117</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-11-01T08:48:56Z</dc:date>
    </item>
    <item>
      <title>Re: DAX formula - calculate market share, compatible with filters and in charts showing categories</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-calculate-market-share-compatible-with-filters-and/m-p/4266696#M169122</link>
      <description>&lt;P&gt;Hay&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="826731" data-lia-user-login="dp_75" class="lia-mention lia-mention-user"&gt;dp_75&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I have had a look at your data and I have a few questions as the results from the DAX posted above would help you solve your problem.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Why in your first post are you counting the Price instead of summing the Price?&lt;BR /&gt;&lt;BR /&gt;I have made a quick mock up for you, but you need to look at the numbers.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&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;BR /&gt;&lt;BR /&gt;If you want to make your data more robust I would suggest &lt;A href="https://learn.microsoft.com/en-us/power-bi/guidance/star-schema" target="_self"&gt;building a data model&lt;/A&gt; and not a flat file for your report.&amp;nbsp; This will help with creating the DAX and then creating the visuals for your metrics.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;This way you can use the dimensions against the measures to filter your data model and you can then choose the way you filter this with DAX or dragging and dropping your data model on to the canvas.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Nov 2024 09:38:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-calculate-market-share-compatible-with-filters-and/m-p/4266696#M169122</guid>
      <dc:creator>DemoFour</dc:creator>
      <dc:date>2024-11-01T09:38:38Z</dc:date>
    </item>
    <item>
      <title>Re: DAX formula - calculate market share, compatible with filters and in charts showing categories</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-calculate-market-share-compatible-with-filters-and/m-p/4267688#M169205</link>
      <description>&lt;P&gt;Thanks all - using removefilters in a new DAX measure solves the market share question.&lt;/P&gt;&lt;P&gt;dp_75&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 02 Nov 2024 11:42:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-formula-calculate-market-share-compatible-with-filters-and/m-p/4267688#M169205</guid>
      <dc:creator>dp_75</dc:creator>
      <dc:date>2024-11-02T11:42:50Z</dc:date>
    </item>
  </channel>
</rss>

