A CALCULATE SUM DAX question based on latest value

rileybloke

New Member
Joined
Feb 7, 2013
Messages
43
Hi All, banging my head against the desk now, so have to ask the pro's... I have a set of data like this...

[TABLE="width: 248"]
<tbody>[TR]
[TD="width: 64, bgcolor: transparent"]Doc No[/TD]
[TD="width: 64, bgcolor: transparent"][/TD]
[TD="width: 75, bgcolor: transparent"]Doc Date[/TD]
[TD="width: 64, bgcolor: transparent"]Item[/TD]
[TD="width: 64, bgcolor: transparent"]Qty[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent, align: right"]1[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent, align: right"]01/02/2014[/TD]
[TD="bgcolor: transparent, align: right"]111[/TD]
[TD="bgcolor: transparent, align: right"]10[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent, align: right"]1[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent, align: right"]01/02/2014[/TD]
[TD="bgcolor: transparent, align: right"]112[/TD]
[TD="bgcolor: transparent, align: right"]15[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent, align: right"]2[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent, align: right"]01/02/2014[/TD]
[TD="bgcolor: transparent, align: right"]113[/TD]
[TD="bgcolor: transparent, align: right"]20[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent, align: right"]2[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent, align: right"]01/02/2014[/TD]
[TD="bgcolor: transparent, align: right"]111[/TD]
[TD="bgcolor: transparent, align: right"]10[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent, align: right"]4[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent, align: right"]03/02/2014[/TD]
[TD="bgcolor: transparent, align: right"]111[/TD]
[TD="bgcolor: transparent, align: right"]10[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent, align: right"]5[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent, align: right"]05/02/2014[/TD]
[TD="bgcolor: transparent, align: right"]113[/TD]
[TD="bgcolor: transparent, align: right"]10[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent, align: right"]6[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent, align: right"]06/02/2014[/TD]
[TD="bgcolor: transparent, align: right"]111[/TD]
[TD="bgcolor: transparent, align: right"]10[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent, align: right"]7[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent, align: right"]07/02/2014[/TD]
[TD="bgcolor: transparent, align: right"]112[/TD]
[TD="bgcolor: transparent, align: right"]10[/TD]
[/TR]
[TR]
[TD="bgcolor: transparent, align: right"]8[/TD]
[TD="bgcolor: transparent"][/TD]
[TD="bgcolor: transparent, align: right"]08/02/2014[/TD]
[TD="bgcolor: transparent, align: right"]111[/TD]
[TD="bgcolor: transparent, align: right"]10[/TD]
[/TR]
</tbody>[/TABLE]



I need to sum the qty for each Doc No, by date but only the DocNo with the highest number, ignoring any previous docs.
Thanks
 
Last edited:
Apologize if this is a stupid question but can you say what exactly the 30 is comprised of on 01/02/14. Suspect there is some simple misunderstanding.

Thanks.
 
Upvote 0

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Then you can change the MAX syntax to include that column, something like LatestDocNo=calculate(max(Table1[Doc No]),filter(Table1,Table1[MSGDATE]=earlier(Table1[MSGDATE])))

?
 
Upvote 0
Nicely done Tianbas!I was able to get the desired results with the example data with your approach. Seems Mozartiano addressed the latest twist with a slight tweak.
 
Upvote 0

Forum statistics

Threads
1,224,044
Messages
6,176,048
Members
452,701
Latest member
rfhandel

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top