<?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: Repartition by max activity in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Repartition-by-max-activity/m-p/4327818#M171810</link>
    <description>&lt;P&gt;Yes ! It perfectly works ! (A little bit long with a big number of data, but not a problem)&lt;BR /&gt;Thank's a lot !&lt;/P&gt;</description>
    <pubDate>Fri, 13 Dec 2024 10:51:55 GMT</pubDate>
    <dc:creator>MichiyoTora</dc:creator>
    <dc:date>2024-12-13T10:51:55Z</dc:date>
    <item>
      <title>Repartition by max activity</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Repartition-by-max-activity/m-p/4325749#M171732</link>
      <description>&lt;P&gt;Hi !&lt;BR /&gt;I've data like this :&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;My goal is to have a pie shart to show the repartition of the members by their most used activity like this :&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;I tried a lot of things to do this but I didn't succeed.&lt;BR /&gt;The difficulty is to show only the type of activity the most used by user (the total have to be the number of users, not take them in count several times in differents types), and it change with the selected date range in visual slicer, so a calculated column is not enought for this problem.&lt;BR /&gt;&lt;BR /&gt;Can you help me please ?&amp;nbsp;&lt;BR /&gt;Thanks !&lt;/P&gt;</description>
      <pubDate>Thu, 12 Dec 2024 10:52:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Repartition-by-max-activity/m-p/4325749#M171732</guid>
      <dc:creator>MichiyoTora</dc:creator>
      <dc:date>2024-12-12T10:52:40Z</dc:date>
    </item>
    <item>
      <title>Re: Repartition by max activity</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Repartition-by-max-activity/m-p/4325802#M171734</link>
      <description>&lt;P&gt;You can try&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Count members with main activity type =
VAR CurrentType =
    SELECTEDVALUE ( activity[type] )
VAR BaseTable =
    ADDCOLUMNS (
        CALCULATETABLE (
            SUMMARIZE ( activity, activity[account], activity[type] ),
            REMOVEFILTERS ( activity[type] )
        ),
        "@sum", CALCULATE ( SUM ( activity[number] ) )
    )
VAR PartitionedTable =
    INDEX (
        1,
        BaseTable,
        ORDERBY ( [@sum], DESC ),
        PARTITIONBY ( activity[account] )
    )
VAR Types =
    GROUPBY (
        PartitionedTable,
        activity[type],
        "@users", SUMX ( CURRENTGROUP (), 1 )
    )
VAR Result =
    SUMX ( FILTER ( Types, activity[type] = CurrentType ), [@users] )
RETURN
    Result
&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 12 Dec 2024 11:31:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Repartition-by-max-activity/m-p/4325802#M171734</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2024-12-12T11:31:18Z</dc:date>
    </item>
    <item>
      <title>Re: Repartition by max activity</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Repartition-by-max-activity/m-p/4325936#M171740</link>
      <description>&lt;P&gt;It seems not working, members still in each type of activity they use, not only the principal one ...&lt;/P&gt;</description>
      <pubDate>Thu, 12 Dec 2024 12:41:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Repartition-by-max-activity/m-p/4325936#M171740</guid>
      <dc:creator>MichiyoTora</dc:creator>
      <dc:date>2024-12-12T12:41:32Z</dc:date>
    </item>
    <item>
      <title>Re: Repartition by max activity</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Repartition-by-max-activity/m-p/4326020#M171745</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="610542" data-lia-user-login="MichiyoTora" class="lia-mention lia-mention-user"&gt;MichiyoTora&lt;/a&gt;&amp;nbsp;- it would be useful to have some sample data to test but I would structure this like so:&lt;BR /&gt;&lt;BR /&gt;Create a measure called Number of Activity:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;SUM( activity[number] )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then reference it in an additional measure:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;VAR RankedActivities =
    ADDCOLUMNS (
       SUMMARIZE ( activity, activity[account], activity[type] ),
        "ActivityRank",
            RANK (
                DENSE,
                ALLSELECTED ( activity[type] ),
                ORDERBY([Number of Activities], DESC),
                ,
                PARTITIONBY(activity[account])
            )
    )
VAR TopActivity =
    FILTER ( RankedActivities, [ActivityRank] = 1 )
RETURN
    CALCULATE (
        [Number of Activities],
        TREATAS ( SELECTCOLUMNS ( TopActivity, "account", activity[account] ), TD_members[account] )
    )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There may be an issue with Ranking in this way inside an add columns, but if you can provide some sample data it would be easier to resolve.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Of course if this works, please accept as the solution. It helps with visibility for others with the same challenge!&lt;/P&gt;</description>
      <pubDate>Thu, 12 Dec 2024 13:27:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Repartition-by-max-activity/m-p/4326020#M171745</guid>
      <dc:creator>mark_endicott</dc:creator>
      <dc:date>2024-12-12T13:27:49Z</dc:date>
    </item>
    <item>
      <title>Re: Repartition by max activity</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Repartition-by-max-activity/m-p/4326149#M171750</link>
      <description>&lt;P&gt;Thank's a lot for your time and your help.&lt;BR /&gt;Power BI found a problem with the partitionby part of your measure. I don't know well enough this option to correct it.&lt;BR /&gt;Here is a sample of my acticity data, you'll be able to create dimensions tables with values function :&amp;nbsp;&lt;A href="https://docs.google.com/spreadsheets/d/1RUHtEUY8Ywsi4vPLvJzk-vh6QSRg6HyOWSWz-PDfFMg/edit?usp=sharing" target="_self"&gt;https://docs.google.com/spreadsheets/d/1RUHtEUY8Ywsi4vPLvJzk-vh6QSRg6HyOWSWz-PDfFMg/edit?usp=sharing&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Dec 2024 14:14:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Repartition-by-max-activity/m-p/4326149#M171750</guid>
      <dc:creator>MichiyoTora</dc:creator>
      <dc:date>2024-12-12T14:14:41Z</dc:date>
    </item>
    <item>
      <title>Re: Repartition by max activity</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Repartition-by-max-activity/m-p/4327618#M171798</link>
      <description>&lt;P&gt;Thanks for the reply from mark_endicott&amp;nbsp; and&amp;nbsp;johnt75&amp;nbsp;&amp;nbsp;, please allow me to provide another insight:&amp;nbsp;&lt;BR /&gt;Hi&amp;nbsp; &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="610542" data-lia-user-login="MichiyoTora" class="lia-mention lia-mention-user"&gt;MichiyoTora&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;I can't open your PBIX, I created the sample data, you can try to create a measure using a virtual table to get the maximum count and then put it in a filter set to 1 to achieve.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&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;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Flag =
var _mindate=MINX(ALLSELECTED('Table'),[date])
var _maxdate=MAXX(ALLSELECTED('Table'),[date])
var _table=
    FILTER(ALLSELECTED('Table'),[date]&amp;gt;=_mindate&amp;amp;&amp;amp;[date]&amp;lt;=_maxdate)
var _table2=
    ADDCOLUMNS(
    _table,"Count",COUNTX(FILTER(_table,[type]=EARLIER([type])),[account]))
var _test=
CONCATENATEX(
    FILTER(_table2,[Count]=MAXX(_table2,[Count])),[type],"-")
return
IF(
    CONTAINSSTRING(
        _test,MAX('Table'[type]))=TRUE(),1,0)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. Place [Flag]in Filters, set is=1, apply filter.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;3. Result:&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;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>Fri, 13 Dec 2024 08:55:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Repartition-by-max-activity/m-p/4327618#M171798</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-12-13T08:55:45Z</dc:date>
    </item>
    <item>
      <title>Re: Repartition by max activity</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Repartition-by-max-activity/m-p/4327648#M171800</link>
      <description>&lt;P&gt;Hi !&lt;BR /&gt;Thank's for your help. It's an approach I've already try.&lt;BR /&gt;If I apply your proposition, it doesn't work because it shows only 1 type of activity (the most representative)&lt;BR /&gt;In your sample of data for example, if the account 3 use "push" more than other activities types, we should have a pie chart with 7 team and 1 push, but we still have 8 team.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Dec 2024 09:10:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Repartition-by-max-activity/m-p/4327648#M171800</guid>
      <dc:creator>MichiyoTora</dc:creator>
      <dc:date>2024-12-13T09:10:58Z</dc:date>
    </item>
    <item>
      <title>Re: Repartition by max activity</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Repartition-by-max-activity/m-p/4327779#M171806</link>
      <description>&lt;P&gt;This works if you use columns from the dimension table rather than the activity table&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Count members with main activity type = 
VAR CurrentType =
    SELECTEDVALUE ( Activities[type] )
VAR BaseTable =
    ADDCOLUMNS (
        CALCULATETABLE (
            SUMMARIZE ( activity, Users[account], Activities[type] ),
            REMOVEFILTERS ( Activities[type] )
        ),
        "@sum", CALCULATE (COUNTROWS( activity ) )
    )
VAR PartitionedTable =
    INDEX (
        1,
        BaseTable,
        ORDERBY ( [@sum], DESC ),
        PARTITIONBY ( Users[account] )
    )
VAR Types =
    GROUPBY (
        PartitionedTable,
        Activities[type],
        "@users", SUMX ( CURRENTGROUP (), 1 )
    )
VAR Result =
    SUMX ( FILTER ( Types, Activities[type] = CurrentType ), [@users] )
RETURN
    Result
	&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 13 Dec 2024 10:26:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Repartition-by-max-activity/m-p/4327779#M171806</guid>
      <dc:creator>johnt75</dc:creator>
      <dc:date>2024-12-13T10:26:17Z</dc:date>
    </item>
    <item>
      <title>Re: Repartition by max activity</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Repartition-by-max-activity/m-p/4327818#M171810</link>
      <description>&lt;P&gt;Yes ! It perfectly works ! (A little bit long with a big number of data, but not a problem)&lt;BR /&gt;Thank's a lot !&lt;/P&gt;</description>
      <pubDate>Fri, 13 Dec 2024 10:51:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Repartition-by-max-activity/m-p/4327818#M171810</guid>
      <dc:creator>MichiyoTora</dc:creator>
      <dc:date>2024-12-13T10:51:55Z</dc:date>
    </item>
    <item>
      <title>Re: Repartition by max activity</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Repartition-by-max-activity/m-p/4327825#M171811</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="610542" data-lia-user-login="MichiyoTora" class="lia-mention lia-mention-user"&gt;MichiyoTora&lt;/a&gt;&amp;nbsp;- Glad&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="240987" data-lia-user-login="johnt75" class="lia-mention lia-mention-user"&gt;johnt75&lt;/a&gt;&amp;nbsp;'s approach worked, I misread your requirement so even if I fixed my DAX it would've given you a completely incorrect answer! Apologies.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Dec 2024 10:56:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Repartition-by-max-activity/m-p/4327825#M171811</guid>
      <dc:creator>mark_endicott</dc:creator>
      <dc:date>2024-12-13T10:56:17Z</dc:date>
    </item>
  </channel>
</rss>

