<?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 to calculate the sum of transactions for all users equal or above a threshold percentile in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-measure-to-calculate-the-sum-of-transactions-for-all-users/m-p/3201629#M116413</link>
    <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="550270" data-lia-user-login="delsaber8" class="lia-mention lia-mention-user"&gt;delsaber8&lt;/a&gt;&amp;nbsp;Sorry, having trouble following, can you post sample data as text and expected output?&lt;BR /&gt;Not really enough information to go on, please first check if your issue is a common issue listed here: &lt;A href="https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882" target="_blank"&gt;https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Also, please see this post regarding How to Get Your Question Answered Quickly: &lt;A href="https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490" target="_blank"&gt;https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;The most important parts are:&lt;BR /&gt;1. Sample data as text, use the table tool in the editing bar&lt;BR /&gt;2. Expected output from sample data&lt;BR /&gt;3. Explanation in words of how to get from 1. to 2.&lt;/P&gt;</description>
    <pubDate>Sun, 23 Apr 2023 19:41:22 GMT</pubDate>
    <dc:creator>Greg_Deckler</dc:creator>
    <dc:date>2023-04-23T19:41:22Z</dc:date>
    <item>
      <title>DAX measure to calculate the sum of transactions for all users equal or above a threshold percentile</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-measure-to-calculate-the-sum-of-transactions-for-all-users/m-p/3201565#M116401</link>
      <description>&lt;P&gt;Hi, I have what I thought was a fairly easy DAX problem, unfortunately I am struggling with it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a user input for a parameter, which takes the input of a percentile. In my data, I have client_IDs associated to any and all of my transactions. I would like to get a measure that calculates the total number of all transactions for clients with a number of transactions at or above the threshold percentile specified by the user. For example, if a user inputs 75 in the what-if parameter, the measure should produce the total number of transactions for all clients equal to or above the 25th percentile as determined by their transactions count. One caveat is that, I need to handle scenarios where there are ties. I want to settle ties arbitrarily. So for example let's say to be in the top 80 percent of clients you need to have at least 2 transactions and to be in the top 70 percent the client needs at least 3 transactions then to get the top 75 we would have to randomly choose to add some of the clients with 2 transactions to our total and to exclude the others. The ones which are kept for the total vs the ones that are not, is not important.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If it were in python it would look like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;number_of_clients =&amp;nbsp;dataset.groupby('client_id').size().shape[0]&lt;/P&gt;&lt;P&gt;top_count = dataset.groupby('client_id').size().sort_values(ascending = False).cumsum()[:math.ceil(what_if_parameter*number_of_clients)].sum()&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 23 Apr 2023 17:08:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-measure-to-calculate-the-sum-of-transactions-for-all-users/m-p/3201565#M116401</guid>
      <dc:creator>delsaber8</dc:creator>
      <dc:date>2023-04-23T17:08:50Z</dc:date>
    </item>
    <item>
      <title>Re: DAX measure to calculate the sum of transactions for all users equal or above a threshold percentile</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-measure-to-calculate-the-sum-of-transactions-for-all-users/m-p/3201629#M116413</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="550270" data-lia-user-login="delsaber8" class="lia-mention lia-mention-user"&gt;delsaber8&lt;/a&gt;&amp;nbsp;Sorry, having trouble following, can you post sample data as text and expected output?&lt;BR /&gt;Not really enough information to go on, please first check if your issue is a common issue listed here: &lt;A href="https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882" target="_blank"&gt;https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Also, please see this post regarding How to Get Your Question Answered Quickly: &lt;A href="https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490" target="_blank"&gt;https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;The most important parts are:&lt;BR /&gt;1. Sample data as text, use the table tool in the editing bar&lt;BR /&gt;2. Expected output from sample data&lt;BR /&gt;3. Explanation in words of how to get from 1. to 2.&lt;/P&gt;</description>
      <pubDate>Sun, 23 Apr 2023 19:41:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-measure-to-calculate-the-sum-of-transactions-for-all-users/m-p/3201629#M116413</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2023-04-23T19:41:22Z</dc:date>
    </item>
    <item>
      <title>Re: DAX measure to calculate the sum of transactions for all users equal or above a threshold percentile</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-measure-to-calculate-the-sum-of-transactions-for-all-users/m-p/3201682#M116416</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="313" data-lia-user-login="Greg_Deckler" class="lia-mention lia-mention-user"&gt;Greg_Deckler&lt;/a&gt; the data should have a similar form to that shown below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I need to do is perform a grouping by each client_ID and count all of their transactions. I then need to order the clients beginning with those that have the most transactions all the way down to the ones that have the least. After this, I need to get a total count of transactions belonging to clients in the upper X percentile, where X is specified by the user. So if the user specifes 75, that means they want to get the total count of transactions for the top 75% of clients. But I need to be sure that the sort order does not result in ties. That is to say, if the top 70% have at least 3 transactions and the top 80% have at least 2 transactions, then to get the top 75% I would include some clients which have only 2 transactions, in the top 75% of clients. So in summary, the output is a single number, which is the total count of transactions corresponding to a group of high volume clients.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Transaction ID&lt;/TD&gt;&lt;TD&gt;Client ID&lt;/TD&gt;&lt;TD&gt;other info&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;12345&lt;/TD&gt;&lt;TD&gt;2345-1&lt;/TD&gt;&lt;TD&gt;....&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;12346&lt;/TD&gt;&lt;TD&gt;0X09-9&lt;/TD&gt;&lt;TD&gt;....&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;12347&lt;/TD&gt;&lt;TD&gt;2345-1&lt;/TD&gt;&lt;TD&gt;....&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;12348&lt;/TD&gt;&lt;TD&gt;EL07-2&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Sun, 23 Apr 2023 22:06:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/DAX-measure-to-calculate-the-sum-of-transactions-for-all-users/m-p/3201682#M116416</guid>
      <dc:creator>delsaber8</dc:creator>
      <dc:date>2023-04-23T22:06:11Z</dc:date>
    </item>
  </channel>
</rss>

