<?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 using DATESBETWEEN wrong total but correct row value in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-using-DATESBETWEEN-wrong-total-but-correct-row-value/m-p/4376527#M173766</link>
    <description>&lt;P&gt;I was able to create a measure containing the initial start date and end date variables/parameter in an measure called "TotalActualCostsTableAmount" and then put it inside the following measure .&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;SUMX (&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;SUMMARIZE (&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;PropertyInfoTable,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;PropertyInfoTable[Name]&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;),&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;CALCULATE (&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;[TotalActualCostsTableAmt],&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;DATESYTD ( 'DateTable'[Date] )&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;)&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;My question is, are there any other more efficient ways of writing this measure that doesn't require SUMX(Summarize. I'm still confused as to why if don't wrap in a SUMX(Summarize and I select a single property the row and total are correct but if I select two or more properties the total get the date logic wrong.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 22 Jan 2025 22:15:53 GMT</pubDate>
    <dc:creator>IM_TRYING_HERE</dc:creator>
    <dc:date>2025-01-22T22:15:53Z</dc:date>
    <item>
      <title>Measure using DATESBETWEEN wrong total but correct row value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-using-DATESBETWEEN-wrong-total-but-correct-row-value/m-p/4369665#M173479</link>
      <description>&lt;P&gt;I am having an issue where the rows in my table visual are showing correct values but the total row is wrong. I assume its related to context transition but I'm not sure. Here is a basic version of my measure along with a screenshot of a basic example of tables and desired result. Any advice is highly appreciated. Thanks&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" color="#3366FF"&gt;MeasureName =&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" color="#3366FF"&gt;VAR stdt =&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" color="#3366FF"&gt;&amp;nbsp; &amp;nbsp; IF (&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" color="#3366FF"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SELECTEDVALUE ( DateTable[YearStartDate] )&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" color="#3366FF"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;= SELECTEDVALUE ( PropertyInfoTable[PurchaseDate] ),&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" color="#3366FF"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SELECTEDVALUE ( DateTable[YearStartDate]),&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" color="#3366FF"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SELECTEDVALUE ( DateTable[YearStartDate])&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" color="#3366FF"&gt;&amp;nbsp; &amp;nbsp; )&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" color="#3366FF"&gt;VAR endt =&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" color="#3366FF"&gt;&amp;nbsp; &amp;nbsp; IF (&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" color="#3366FF"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SELECTEDVALUE ( PropertyInfoTable[SellDate]) = BLANK (),&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" color="#3366FF"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SELECTEDVALUE ( DateTable[Date] ),&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" color="#3366FF"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SELECTEDVALUE ( PropertyInfoTable[SellDate])&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" color="#3366FF"&gt;&amp;nbsp; &amp;nbsp; )&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" color="#3366FF"&gt;RETURN&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" color="#3366FF"&gt;&amp;nbsp; &amp;nbsp; SUMX (&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" color="#3366FF"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SUMMARIZE (&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" color="#3366FF"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; PropertyInfoTable,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" color="#3366FF"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; PropertyInfoTable[Name]&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" color="#3366FF"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ),&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" color="#3366FF"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; CALCULATE (&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" color="#3366FF"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SUM ( ActualCostsTable[Amount] ),&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" color="#3366FF"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DATESBETWEEN ( DateTable[Date], stdt, endt )&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" color="#3366FF"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; )&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2" color="#3366FF"&gt;&amp;nbsp; &amp;nbsp; )&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jan 2025 18:06:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-using-DATESBETWEEN-wrong-total-but-correct-row-value/m-p/4369665#M173479</guid>
      <dc:creator>IM_TRYING_HERE</dc:creator>
      <dc:date>2025-01-17T18:06:57Z</dc:date>
    </item>
    <item>
      <title>Re: Measure using DATESBETWEEN wrong total but correct row value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-using-DATESBETWEEN-wrong-total-but-correct-row-value/m-p/4369768#M173480</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="726957" data-lia-user-login="IM_TRYING_HERE" class="lia-mention lia-mention-user"&gt;IM_TRYING_HERE&lt;/a&gt;&amp;nbsp;First, please vote for this idea: &lt;A href="https://ideas.powerbi.com/ideas/idea/?ideaid=082203f1-594f-4ba7-ac87-bb91096c742e" target="_blank"&gt;https://ideas.powerbi.com/ideas/idea/?ideaid=082203f1-594f-4ba7-ac87-bb91096c742e&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;This looks like a measure totals problem. Very common. See my post about it here: &lt;A href="https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376" target="_blank"&gt;https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Also, this Quick Measure, Measure Totals, The Final Word should get you what you need:&lt;BR /&gt;&lt;A href="https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907" target="_blank"&gt;https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Also: &lt;A href="https://youtu.be/uXRriTN0cfY" target="_blank"&gt;https://youtu.be/uXRriTN0cfY&lt;/A&gt;&lt;BR /&gt;And: &lt;A href="https://youtu.be/n4TYhF2ARe8" target="_blank"&gt;https://youtu.be/n4TYhF2ARe8&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jan 2025 20:29:54 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-using-DATESBETWEEN-wrong-total-but-correct-row-value/m-p/4369768#M173480</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2025-01-17T20:29:54Z</dc:date>
    </item>
    <item>
      <title>Re: Measure using DATESBETWEEN wrong total but correct row value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-using-DATESBETWEEN-wrong-total-but-correct-row-value/m-p/4371721#M173556</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="726957" data-lia-user-login="IM_TRYING_HERE" class="lia-mention lia-mention-user"&gt;IM_TRYING_HERE&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can try below measure:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;MeasureName =
SUMX(VALUES(PropertyInfoTable[Name]),CALCULATE(

VAR stdt =

    IF (

        SELECTEDVALUE ( DateTable[YearStartDate] )

            &amp;lt;= SELECTEDVALUE ( PropertyInfoTable[PurchaseDate] ),

        SELECTEDVALUE ( DateTable[YearStartDate]),

        SELECTEDVALUE ( DateTable[YearStartDate])

    )

VAR endt =

    IF (

        SELECTEDVALUE ( PropertyInfoTable[SellDate]) = BLANK (),

        SELECTEDVALUE ( DateTable[Date] ),

        SELECTEDVALUE ( PropertyInfoTable[SellDate])

    )

RETURN

    SUMX (

        SUMMARIZE (

            PropertyInfoTable,

            PropertyInfoTable[Name]

        ),

        CALCULATE (

            SUM ( ActualCostsTable[Amount] ),

            DATESBETWEEN ( DateTable[Date], stdt, endt )

        )

    )
  )
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Did I answer your question? If yes, pls mark my post as a solution and appreciate your Kudos !&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you~&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jan 2025 11:00:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-using-DATESBETWEEN-wrong-total-but-correct-row-value/m-p/4371721#M173556</guid>
      <dc:creator>xifeng_L</dc:creator>
      <dc:date>2025-01-20T11:00:22Z</dc:date>
    </item>
    <item>
      <title>Re: Measure using DATESBETWEEN wrong total but correct row value</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-using-DATESBETWEEN-wrong-total-but-correct-row-value/m-p/4376527#M173766</link>
      <description>&lt;P&gt;I was able to create a measure containing the initial start date and end date variables/parameter in an measure called "TotalActualCostsTableAmount" and then put it inside the following measure .&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;SUMX (&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;SUMMARIZE (&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;PropertyInfoTable,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;PropertyInfoTable[Name]&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;),&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;CALCULATE (&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;[TotalActualCostsTableAmt],&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;DATESYTD ( 'DateTable'[Date] )&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;)&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;My question is, are there any other more efficient ways of writing this measure that doesn't require SUMX(Summarize. I'm still confused as to why if don't wrap in a SUMX(Summarize and I select a single property the row and total are correct but if I select two or more properties the total get the date logic wrong.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jan 2025 22:15:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Measure-using-DATESBETWEEN-wrong-total-but-correct-row-value/m-p/4376527#M173766</guid>
      <dc:creator>IM_TRYING_HERE</dc:creator>
      <dc:date>2025-01-22T22:15:53Z</dc:date>
    </item>
  </channel>
</rss>

