<?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: Sum a column based grouping by another one, but respecting user filters in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-a-column-based-grouping-by-another-one-but-respecting-user/m-p/3049567#M104987</link>
    <description>&lt;P&gt;2. Activities per Customer = CALCULATE(COUNT(fact_activities[sk_activity]), FILTER(ALL(dim_customer), dim_customer[sk_customer] = fact_activities[sk_customer]))&lt;/P&gt;</description>
    <pubDate>Mon, 30 Jan 2023 06:23:55 GMT</pubDate>
    <dc:creator>Sahir_Maharaj</dc:creator>
    <dc:date>2023-01-30T06:23:55Z</dc:date>
    <item>
      <title>Sum a column based grouping by another one, but respecting user filters</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-a-column-based-grouping-by-another-one-but-respecting-user/m-p/3049048#M104946</link>
      <description>&lt;P&gt;I am new to DAX and I am depressed by how hard it is.&lt;/P&gt;&lt;P&gt;I need to do a very, VERY simple thing that can be summarized as "I want to create measures that count a column grouped by&amp;nbsp; &amp;nbsp;another one, but that respect the filters already in place by the user."&lt;/P&gt;&lt;P&gt;Let me explain it in a toy model (I do not post the real one because it is in Portuguese).&lt;/P&gt;&lt;P&gt;I have a fact table about user activity, a dimension table of users, and a dimension table of customers.&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;customer 1- * fact_activities *-1users&lt;/P&gt;&lt;P&gt;There is also an activity-type table.&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;activity_type 1-*&amp;nbsp;fact_activities &amp;nbsp;&lt;/P&gt;&lt;P&gt;The user may filter by activity date, activity type, customer_type, and others. Some filters are on&amp;nbsp;fact_activities, but also on&amp;nbsp;the other tables.&lt;/P&gt;&lt;P&gt;I need things like: activities per user, activities per customer, activities per user per customer, etc.&lt;/P&gt;&lt;P&gt;I have tried many things. One example. This is an attempted measure on users.&lt;BR /&gt;I hoped that &lt;SPAN&gt;KEEPFILTERS would, you know, keep the filters, but the measure ignores &lt;/SPAN&gt;user filters:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;activities_per_user = &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt; &lt;SPAN&gt;_user_sk&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;dim_user[sk_user]&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;RETURN&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;COUNTX&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;FILTER&lt;/SPAN&gt;&lt;SPAN&gt;(&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;KEEPFILTERS&lt;/SPAN&gt;&lt;SPAN&gt;(fact_activities&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;fact_activities[sk_user] =&amp;nbsp;_user_sk&amp;nbsp;),&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;fact_activities[sk_activity]&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Please help,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Sun, 29 Jan 2023 18:25:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-a-column-based-grouping-by-another-one-but-respecting-user/m-p/3049048#M104946</guid>
      <dc:creator>jrbmendes</dc:creator>
      <dc:date>2023-01-29T18:25:59Z</dc:date>
    </item>
    <item>
      <title>Re: Sum a column based grouping by another one, but respecting user filters</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-a-column-based-grouping-by-another-one-but-respecting-user/m-p/3049093#M104952</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="506265" data-lia-user-login="jrbmendes" class="lia-mention lia-mention-user"&gt;jrbmendes&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;try using ALLSELECTED if you want to accept external filters.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;something like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;SPAN&gt;activities_per_user =&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;_user_sk&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;=&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;dim_user[sk_user]&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;RETURN&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;COUNTX&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;FILTER&lt;/SPAN&gt;&lt;SPAN&gt;(&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;'&lt;/SPAN&gt;&lt;SPAN&gt;fact_activities'&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;'fact_activities'[sk_user] =&amp;nbsp;_user_sk,&lt;BR /&gt;&amp;nbsp;ALLSELECTED()&lt;BR /&gt;),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;fact_activities[sk_activity]&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Please help,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;P&gt;Appreciate a thumbs up if this is helpful.&lt;/P&gt;</description>
      <pubDate>Sun, 29 Jan 2023 20:32:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-a-column-based-grouping-by-another-one-but-respecting-user/m-p/3049093#M104952</guid>
      <dc:creator>adudani</dc:creator>
      <dc:date>2023-01-29T20:32:42Z</dc:date>
    </item>
    <item>
      <title>Re: Sum a column based grouping by another one, but respecting user filters</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-a-column-based-grouping-by-another-one-but-respecting-user/m-p/3049096#M104953</link>
      <description>&lt;P&gt;hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="506265" data-lia-user-login="jrbmendes" class="lia-mention lia-mention-user"&gt;jrbmendes&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;SPAN&gt;Try just plot a visual with&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;dim_user[sk_user] column and a measure like:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;Measure =&amp;nbsp;COUNTROWS(RELATEDTABLE(fact_activities))&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;do you get what you expect?&lt;/DIV&gt;</description>
      <pubDate>Sun, 29 Jan 2023 20:33:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-a-column-based-grouping-by-another-one-but-respecting-user/m-p/3049096#M104953</guid>
      <dc:creator>FreemanZ</dc:creator>
      <dc:date>2023-01-29T20:33:25Z</dc:date>
    </item>
    <item>
      <title>Re: Sum a column based grouping by another one, but respecting user filters</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-a-column-based-grouping-by-another-one-but-respecting-user/m-p/3049158#M104956</link>
      <description>&lt;P&gt;Sorry. It seems to have a syntax error that I do not manage to fix&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 29 Jan 2023 23:31:13 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-a-column-based-grouping-by-another-one-but-respecting-user/m-p/3049158#M104956</guid>
      <dc:creator>jrbmendes</dc:creator>
      <dc:date>2023-01-29T23:31:13Z</dc:date>
    </item>
    <item>
      <title>Re: Sum a column based grouping by another one, but respecting user filters</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-a-column-based-grouping-by-another-one-but-respecting-user/m-p/3049159#M104957</link>
      <description>&lt;P&gt;Ignore my previous reply. It worked. Thanks a lot.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jan 2023 14:00:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-a-column-based-grouping-by-another-one-but-respecting-user/m-p/3049159#M104957</guid>
      <dc:creator>jrbmendes</dc:creator>
      <dc:date>2023-01-30T14:00:54Z</dc:date>
    </item>
    <item>
      <title>Re: Sum a column based grouping by another one, but respecting user filters</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-a-column-based-grouping-by-another-one-but-respecting-user/m-p/3049565#M104986</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="506265" data-lia-user-login="jrbmendes" class="lia-mention lia-mention-user"&gt;jrbmendes&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To solve your problem, you can try using the DAX formula below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. Activities per User = CALCULATE(COUNT(fact_activities[sk_activity]), FILTER(ALL(dim_user), dim_user[sk_user] = fact_activities[sk_user]))&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jan 2023 06:23:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-a-column-based-grouping-by-another-one-but-respecting-user/m-p/3049565#M104986</guid>
      <dc:creator>Sahir_Maharaj</dc:creator>
      <dc:date>2023-01-30T06:23:17Z</dc:date>
    </item>
    <item>
      <title>Re: Sum a column based grouping by another one, but respecting user filters</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-a-column-based-grouping-by-another-one-but-respecting-user/m-p/3049567#M104987</link>
      <description>&lt;P&gt;2. Activities per Customer = CALCULATE(COUNT(fact_activities[sk_activity]), FILTER(ALL(dim_customer), dim_customer[sk_customer] = fact_activities[sk_customer]))&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jan 2023 06:23:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-a-column-based-grouping-by-another-one-but-respecting-user/m-p/3049567#M104987</guid>
      <dc:creator>Sahir_Maharaj</dc:creator>
      <dc:date>2023-01-30T06:23:55Z</dc:date>
    </item>
    <item>
      <title>Re: Sum a column based grouping by another one, but respecting user filters</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-a-column-based-grouping-by-another-one-but-respecting-user/m-p/3049570#M104988</link>
      <description>&lt;P&gt;3. Activities per User per Customer = CALCULATE(COUNT(fact_activities[sk_activity]), FILTER(ALL(dim_user), dim_user[sk_user] = fact_activities[sk_user]), FILTER(ALL(dim_customer), dim_customer[sk_customer] = fact_activities[sk_customer]))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jan 2023 06:24:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-a-column-based-grouping-by-another-one-but-respecting-user/m-p/3049570#M104988</guid>
      <dc:creator>Sahir_Maharaj</dc:creator>
      <dc:date>2023-01-30T06:24:15Z</dc:date>
    </item>
    <item>
      <title>Re: Sum a column based grouping by another one, but respecting user filters</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-a-column-based-grouping-by-another-one-but-respecting-user/m-p/3049573#M104989</link>
      <description>&lt;P&gt;Activities per User per Activity Type = CALCULATE(COUNT(fact_activities[sk_activity]), FILTER(ALL(dim_user), dim_user[sk_user] = fact_activities[sk_user]), FILTER(ALL(activity_type), activity_type[sk_activity_type] = fact_activities[sk_activity_type]))&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jan 2023 06:24:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-a-column-based-grouping-by-another-one-but-respecting-user/m-p/3049573#M104989</guid>
      <dc:creator>Sahir_Maharaj</dc:creator>
      <dc:date>2023-01-30T06:24:34Z</dc:date>
    </item>
    <item>
      <title>Re: Sum a column based grouping by another one, but respecting user filters</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-a-column-based-grouping-by-another-one-but-respecting-user/m-p/3049574#M104990</link>
      <description>&lt;P&gt;Activities per Customer per Activity Type = CALCULATE(COUNT(fact_activities[sk_activity]), FILTER(ALL(dim_customer), dim_customer[sk_customer] = fact_activities[sk_customer]), FILTER(ALL(activity_type), activity_type[sk_activity_type] = fact_activities[sk_activity_type]))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;These formulas will give you the required results while preserving the filters.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jan 2023 06:24:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-a-column-based-grouping-by-another-one-but-respecting-user/m-p/3049574#M104990</guid>
      <dc:creator>Sahir_Maharaj</dc:creator>
      <dc:date>2023-01-30T06:24:49Z</dc:date>
    </item>
    <item>
      <title>Re: Sum a column based grouping by another one, but respecting user filters</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-a-column-based-grouping-by-another-one-but-respecting-user/m-p/3049580#M104991</link>
      <description>&lt;P&gt;Hope this helps &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jan 2023 06:25:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-a-column-based-grouping-by-another-one-but-respecting-user/m-p/3049580#M104991</guid>
      <dc:creator>Sahir_Maharaj</dc:creator>
      <dc:date>2023-01-30T06:25:52Z</dc:date>
    </item>
    <item>
      <title>Re: Sum a column based grouping by another one, but respecting user filters</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-a-column-based-grouping-by-another-one-but-respecting-user/m-p/3050441#M105049</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I've receive the message "&lt;/SPAN&gt;&lt;SPAN&gt;A&amp;nbsp;&lt;EM&gt;single value for column&lt;/EM&gt;&amp;nbsp;'sk_user in table 'fact_activities'&amp;nbsp;&lt;EM&gt;cannot be determined&lt;/EM&gt;.&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;This is true because there is an one to n between&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;dim_user and&amp;nbsp;fact_activities&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jan 2023 13:56:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Sum-a-column-based-grouping-by-another-one-but-respecting-user/m-p/3050441#M105049</guid>
      <dc:creator>jrbmendes</dc:creator>
      <dc:date>2023-01-30T13:56:48Z</dc:date>
    </item>
  </channel>
</rss>

