<?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 Power BI - Get the sum of the Last/Latest Value of a Category/Group in Quick Measures Gallery</title>
    <link>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Power-BI-Get-the-sum-of-the-Last-Latest-Value-of-a-Category/m-p/2639410#M866</link>
    <description>&lt;H1&gt;Power BI - Get the sum of the Last/Latest Value of a Category/Group&lt;/H1&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H2&gt;Problem Statement:&lt;/H2&gt;
&lt;P&gt;In the given data filter and show only the most recent row based on date/version etc. It should also do the correct sum.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the last &lt;A href="https://community.powerbi.com/t5/Quick-Measures-Gallery/Power-BI-Get-the-Last-Latest-Value-of-a-Category-Group/td-p/2629069" target="_self"&gt;blog&lt;/A&gt;, I discussed how can we get the latest status, but it will not give the correct grand total for qty/value.&amp;nbsp;&lt;BR /&gt;Data: I have taken data where we have ID and date along with Qty. And we would like to show the latest Qty.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H2&gt;Solution:&lt;/H2&gt;
&lt;P&gt;We will use a DAX measure for that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have loaded the data to the power bi file and created the following DAX measure&lt;BR /&gt;DAX Code- I created 2 measures&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Last Qty = Var _max = maxx(filter( ALLSELECTED(Data1), Data1[ID] = max(Data1[ID]) ),Data1[Date])
return 
CALCULATE(sum(Data1[qty]), filter( (Data1), Data1[ID] = max(Data1[ID])  &amp;amp;&amp;amp; Data1[Date] =_max))

Sum Last Qty = sumx(VALUES(Data1[ID]) , [Last Qty])&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please check more details on the blog&lt;/P&gt;</description>
    <pubDate>Thu, 14 Jul 2022 17:13:14 GMT</pubDate>
    <dc:creator>amitchandak</dc:creator>
    <dc:date>2022-07-14T17:13:14Z</dc:date>
    <item>
      <title>Power BI - Get the sum of the Last/Latest Value of a Category/Group</title>
      <link>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Power-BI-Get-the-sum-of-the-Last-Latest-Value-of-a-Category/m-p/2639410#M866</link>
      <description>&lt;H1&gt;Power BI - Get the sum of the Last/Latest Value of a Category/Group&lt;/H1&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H2&gt;Problem Statement:&lt;/H2&gt;
&lt;P&gt;In the given data filter and show only the most recent row based on date/version etc. It should also do the correct sum.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the last &lt;A href="https://community.powerbi.com/t5/Quick-Measures-Gallery/Power-BI-Get-the-Last-Latest-Value-of-a-Category-Group/td-p/2629069" target="_self"&gt;blog&lt;/A&gt;, I discussed how can we get the latest status, but it will not give the correct grand total for qty/value.&amp;nbsp;&lt;BR /&gt;Data: I have taken data where we have ID and date along with Qty. And we would like to show the latest Qty.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H2&gt;Solution:&lt;/H2&gt;
&lt;P&gt;We will use a DAX measure for that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have loaded the data to the power bi file and created the following DAX measure&lt;BR /&gt;DAX Code- I created 2 measures&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Last Qty = Var _max = maxx(filter( ALLSELECTED(Data1), Data1[ID] = max(Data1[ID]) ),Data1[Date])
return 
CALCULATE(sum(Data1[qty]), filter( (Data1), Data1[ID] = max(Data1[ID])  &amp;amp;&amp;amp; Data1[Date] =_max))

Sum Last Qty = sumx(VALUES(Data1[ID]) , [Last Qty])&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please check more details on the blog&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jul 2022 17:13:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Power-BI-Get-the-sum-of-the-Last-Latest-Value-of-a-Category/m-p/2639410#M866</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2022-07-14T17:13:14Z</dc:date>
    </item>
    <item>
      <title>Re: Power BI - Get the sum of the Last/Latest Value of a Category/Group</title>
      <link>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Power-BI-Get-the-sum-of-the-Last-Latest-Value-of-a-Category/m-p/3340879#M990</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to build a matrix in PowerBI and have created a new measure for my value field:&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;PSUs = &lt;/SPAN&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;DISTINCTCOUNT&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;ARPU&lt;/SPAN&gt;&lt;SPAN&gt;[DistinctNumber]&lt;/SPAN&gt;&lt;SPAN&gt;)) to count distinct values, but the subtotals are not correct with this method.&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Do you have any suggestions? &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;img /&gt;&lt;img /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 20 Jul 2023 12:55:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/Power-BI-Get-the-sum-of-the-Last-Latest-Value-of-a-Category/m-p/3340879#M990</guid>
      <dc:creator>LoganH244</dc:creator>
      <dc:date>2023-07-20T12:55:19Z</dc:date>
    </item>
  </channel>
</rss>

