title: How to select the last value of the day with DAX in Power BI
body: <p>I am new to power BI and stuck with an issue. I have my model as follows:</p>
  
  <ul>
  <li>Date Dimension</li>
  <li>Measurement Fact</li>
  </ul>
  
  <p>The date column in Date Dimension is link to measuredate in Measurement Fact</p>
  
  <p>Below is a sample data:</p>
  
  <p><a href="https://i.stack.imgur.com/WkLsE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WkLsE.png" alt="enter image description here"></a></p>
  
  <p>NB: In edit query, I have changed the type of measuredate to Date only.</p>
  
  <p>I have tried the measure below but it doesn't work the way I want. It will sum all the values of the day but what I want is the last value of the day:</p>
  
  <pre><code>day_fuel_consumption =
  CALCULATE (
      SUM ( measurement[measurementvalue] ),
      FILTER (
          measurement,
          measurement[metername] = "C-FUEL"
       &amp;&amp; measurement[measuredate] = MAX ( measurement[measuredate] )
      )
  )
  </code></pre>
  
  <p>My Goal is to get <strong>29242</strong>, i.e the last value of the day. Remember that measuredate is a Date field and not Datetime (I changed to Date field so that my Year and Month filter can work correctly). I have changed the type in edit query.</p>