<?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: Measure in Live Connection - Incorrect Total in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-in-Live-Connection-Incorrect-Total/m-p/2770165#M86209</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317289" data-lia-user-login="tamerj1" class="lia-mention lia-mention-user"&gt;tamerj1&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The Location Practice and Rendering Name doesn'y matter because when I put the measure in a card alone I still get the wrong total. See below:&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;So you can see the Total issue has nothing to do with the Locations column.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;These are the key relationships. Remember, this is a Live Connection Analysis Services:&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;Let me know if you need anything else. And thank you for your support&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 15 Sep 2022 10:53:28 GMT</pubDate>
    <dc:creator>sabilahmed</dc:creator>
    <dc:date>2022-09-15T10:53:28Z</dc:date>
    <item>
      <title>Measure in Live Connection - Incorrect Total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-in-Live-Connection-Incorrect-Total/m-p/2769846#M86183</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I know there have been many solutions on incorrect totals from measures in Live Connection, but I can't seem to figure out the solution for my measure:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;No of Sessions = 
 VAR _encounters =
    CALCULATE (
        [Amount],
        FILTER (
            ALL ( 'Profitability Account' ),
            'Profitability Account'[Description] = "Encounters"
        )
    )
 VAR _NoOfDays = Calculate(DISTINCTCOUNT('Time'[CalendarDate]),Filter ('Time', 'Time'[DayOfWeekdayDescription] &amp;lt;&amp;gt; "Sunday" &amp;amp;&amp;amp; 'Time'[DayOfWeekdayDescription] &amp;lt;&amp;gt; "Saturday"  ))
 VAR _NoOfSession = _NoOfDays * SWITCH (
        TRUE (),
        _encounters &amp;lt;= 2, 0,
        _encounters &amp;gt;= 2
            &amp;amp;&amp;amp; _encounters &amp;lt;= 10, 1,
        _encounters &amp;gt; 10, 2
    )
 RETURN _NoOfSession&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This gives me the following result (I have covered up the practice locations):&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;You can see the No of Sessions total is incorrect.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I even attempted something different by trying something different. I wanted to try something like DISTINCTCOUNTX (but this does not exist in DAX) - so I found the below solution:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;No of Sessions New = 
 VAR _NoOfDays = COUNTROWS( DISTINCT( SELECTCOLUMNS( 'Time', "CalendarDate",'Time'[DayOfWeekdayDescription] &amp;lt;&amp;gt; "Sunday" &amp;amp;&amp;amp; 'Time'[DayOfWeekdayDescription] &amp;lt;&amp;gt; "Saturday"  )))
 VAR _NoOfSession = _NoOfDays * IF (
        [Encounters] &amp;lt;= 2, 0,
        IF([Encounters] &amp;gt;= 2
            &amp;amp;&amp;amp; [Encounters] &amp;lt;= 10, 1,
        2
    ))
 RETURN _NoOfSession&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I replaced the VAR _encounters with a measure instead [encounters] . And I replaced the SWITCH statement for an IF statement instead to see if that will do anything different, but it still doesn't work:&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;The following is the Encounters measure (it's exactly the same as in the original No of Sessions DAX:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Encounters = CALCULATE (
                [Amount],
                FILTER (
                    ALL ( 'Profitability Account' ),
                    'Profitability Account'[Description] = "Encounters"
                ))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help me write a new DAX measure that will fix this issue and give me correct Totals&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Sep 2022 09:26:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-in-Live-Connection-Incorrect-Total/m-p/2769846#M86183</guid>
      <dc:creator>sabilahmed</dc:creator>
      <dc:date>2022-09-15T09:26:09Z</dc:date>
    </item>
    <item>
      <title>Re: Measure in Live Connection - Incorrect Total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-in-Live-Connection-Incorrect-Total/m-p/2770040#M86197</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="352657" data-lia-user-login="sabilahmed" class="lia-mention lia-mention-user"&gt;sabilahmed&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Location, Practice and Rendering Name from which table(s)? If multiple tables are involved in this visual, would you please advise the relationships?&lt;/P&gt;</description>
      <pubDate>Thu, 15 Sep 2022 10:10:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-in-Live-Connection-Incorrect-Total/m-p/2770040#M86197</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-09-15T10:10:44Z</dc:date>
    </item>
    <item>
      <title>Re: Measure in Live Connection - Incorrect Total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-in-Live-Connection-Incorrect-Total/m-p/2770165#M86209</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317289" data-lia-user-login="tamerj1" class="lia-mention lia-mention-user"&gt;tamerj1&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The Location Practice and Rendering Name doesn'y matter because when I put the measure in a card alone I still get the wrong total. See below:&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;So you can see the Total issue has nothing to do with the Locations column.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;These are the key relationships. Remember, this is a Live Connection Analysis Services:&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;Let me know if you need anything else. And thank you for your support&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Sep 2022 10:53:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-in-Live-Connection-Incorrect-Total/m-p/2770165#M86209</guid>
      <dc:creator>sabilahmed</dc:creator>
      <dc:date>2022-09-15T10:53:28Z</dc:date>
    </item>
    <item>
      <title>Re: Measure in Live Connection - Incorrect Total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-in-Live-Connection-Incorrect-Total/m-p/2775929#M86672</link>
      <description>&lt;P&gt;Solved! I used ADDCOLUMNS and SUMMARIZE:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;No of Sessions = 

VAR SessionsTable =

        ADDCOLUMNS (    
            SUMMARIZE (
            'Location-Practice-Rendering',
            'Location-Practice-Rendering'[LeafName]
            ),
            "Total Encounters",
                [Encounters],
            "No of Days Total",
                [No of Days],
            "No of Sessions Per Day",
                IF ( [Encounters] &amp;lt;= 2, 0,
                IF ( [Encounters] &amp;gt; 10, 2, 1
                    )
                )
        )

        RETURN SUMX( SessionsTable, [No of Days Total] * [No of Sessions Per Day])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Where [Encounters] and [No of Days] are separate measures:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Encounters = CALCULATE (
                [Amount],
                FILTER (
                    ALL ( 'Profitability Account' ),
                    'Profitability Account'[Description] = "Encounters"
                ))&lt;/LI-CODE&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;LI-CODE lang="javascript"&gt;No of Days = 
    CALCULATE (
                DISTINCTCOUNT (
                'Time'[CalendarDate]),
                FILTER (
                'Time',
                'Time'[DayOfWeekdayDescription] &amp;lt;&amp;gt; "Sunday"
                &amp;amp;&amp;amp; 'Time'[DayOfWeekdayDescription] &amp;lt;&amp;gt; "Saturday"  )
                )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Results:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;(Doctor Days is simply a measure: No of Sessions divided by 2).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Sep 2022 16:18:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-in-Live-Connection-Incorrect-Total/m-p/2775929#M86672</guid>
      <dc:creator>sabilahmed</dc:creator>
      <dc:date>2022-09-18T16:18:10Z</dc:date>
    </item>
  </channel>
</rss>

