Power BI — Get the sum of the Last/Latest Value of a Category
Problem Statement: In the given data filter and show only the most recent row based on date/version etc. It should also do the correct sum.
In the last blog, I discussed how can we get the latest status, but it will not give the correct grand total for qty/value.
Data: I have taken data where we have ID and date along with Qty. And we would like to show the latest Qty.
Solution: We will use DAX measures for that.
I have loaded the data to the power bi file and created the following DAX measure
DAX Code- I created 2 measures
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]) && Data1[Date] =_max))Sum Last Qty = sumx(VALUES(Data1[ID]) , [Last Qty])
You can find the file on Power BI Community. Please like and share.
Find the Video here
Click Here to access all my blogs and videos in a jiffy via an exclusive visual glossary using Power BI.
Please like, share, and comment on these. Your suggestions on improvement, challenges, and new topics will help me explore more.
You Can watch my Power BI Tutorial Series on My Channel, Subscribe, Like, and share.