<?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 of a measure ? in a model with Many To Many relations) in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUM-of-a-measure-in-a-model-with-Many-To-Many-relations/m-p/2948373#M97625</link>
    <description>&lt;P&gt;thanks, but it didnt work, I dont understand why it can't just add the measure...&lt;/P&gt;</description>
    <pubDate>Mon, 05 Dec 2022 12:24:03 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2022-12-05T12:24:03Z</dc:date>
    <item>
      <title>SUM of a measure ? in a model with Many To Many relations)</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUM-of-a-measure-in-a-model-with-Many-To-Many-relations/m-p/2946652#M97529</link>
      <description>&lt;P&gt;I have a model where I have my&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;fact&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;and&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;Project&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;Dimension:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But I also have a 1:* relationship between&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;Project&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;and&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;Roles&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That is:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Fact&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;*&amp;nbsp; &amp;nbsp; &amp;nbsp;1&lt;STRONG&gt;Project&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Project&lt;/STRONG&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp;*&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;Roles&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;(for a given project I have 3 ppl: ‘responsible’, ‘boss’, ‘control’)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have this measure that I am using (in a matrix visual), where I display some custom aggregation:&lt;/P&gt;&lt;P&gt;My levels are:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;End Customer&lt;UL&gt;&lt;LI&gt;Level 1&lt;UL&gt;&lt;LI&gt;Level 2&lt;UL&gt;&lt;LI&gt;Level 3&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Result:=

VAR _part1 =SUMX ( SUMMARIZE (  FILTER (  ALL ( 'Fact' ),Fact[Level1] = MAX ( Fact[Level1] ) &amp;amp;&amp;amp; Fact[Level2] IN VALUES (  Fact[Level2] )
),

            Fact[Level1],
            Fact[Level2]
        ),
       [Basic])
...

Return SWITCH (

    TRUE(),

    ISINSCOPE (Fact[Level3] ), [Basic],

    ISINSCOPE (Fact[Level2] ), [Basic],

    ISINSCOPE (Fact[Level1] ), _part1,

    ISINSCOPE (Fact[End Customer] ), _part2
)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now , to the top level (in my matrix visual) I want to add Roles[Name] ... Of course I need a ISINSCOPE for this case:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;ISINSCOPE (Roles[Name] ), xyz,&lt;/PRE&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;P&gt;But I have tried writing the&amp;nbsp; &amp;nbsp;&lt;STRONG&gt;xyz&lt;/STRONG&gt;&amp;nbsp; &amp;nbsp;code in every way and I can't make it work&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(For all my other cases it works, because I bring the columns level1,level2, etc from the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;dim&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;to the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;fact&lt;/STRONG&gt;, but now I can’t do this because I have a&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;*&amp;nbsp;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;to&amp;nbsp; &amp;nbsp;&lt;STRONG&gt;*&lt;/STRONG&gt;&amp;nbsp; relationship).&lt;/P&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(the agreggation shall be just a SUM of whatever is on End Customer)&lt;/P&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;This is my visual:&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;img /&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;&lt;P&gt;In Green is level3, and brown level2.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This works perfectly fine, with the measure described...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But, now i want to add a higher level:&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;Roles[EmployeeName]&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Sun, 04 Dec 2022 17:03:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUM-of-a-measure-in-a-model-with-Many-To-Many-relations/m-p/2946652#M97529</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-12-04T17:03:45Z</dc:date>
    </item>
    <item>
      <title>Re: SUM of a measure ? in a model with Many To Many relations)</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUM-of-a-measure-in-a-model-with-Many-To-Many-relations/m-p/2946683#M97533</link>
      <description>&lt;P&gt;Hi&amp;nbsp;Anonymous&lt;/LI-USER&gt;&amp;nbsp;&lt;BR /&gt;Please try&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;Result :=
SUMX (
    CROSSJOIN (
        VALUES ( Roles[Name] ),
        SUMMARIZE ( 'Fact', Fact[Level1], Fact[Level2], Fact[Level3] )
    ),
    [Basic]
)&lt;/LI-CODE&gt;</description>
      <pubDate>Sun, 04 Dec 2022 18:22:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUM-of-a-measure-in-a-model-with-Many-To-Many-relations/m-p/2946683#M97533</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-12-04T18:22:07Z</dc:date>
    </item>
    <item>
      <title>Re: SUM of a measure ? in a model with Many To Many relations)</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUM-of-a-measure-in-a-model-with-Many-To-Many-relations/m-p/2948373#M97625</link>
      <description>&lt;P&gt;thanks, but it didnt work, I dont understand why it can't just add the measure...&lt;/P&gt;</description>
      <pubDate>Mon, 05 Dec 2022 12:24:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/SUM-of-a-measure-in-a-model-with-Many-To-Many-relations/m-p/2948373#M97625</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-12-05T12:24:03Z</dc:date>
    </item>
  </channel>
</rss>

