Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
swarnendu
Creator II
Creator II

how to pick max date wise value for each row?

Hi all,

I have a table showing Master_Code, Master_Code_NO , dates and quantities:

errpppp.jpg

I want to pick the value   for each master code number using by an expression the last date value in the table

Can someone let me know how ?

i used the expression is

=Sum({<%Tran_Date={'$(vTEST)'}>}Opening_Qty)

where

vTEST =(max({<Opening_Qty = {'<>0'}>}%Tran_Date))

thx.

Swarnendu

26 Replies
swarnendu
Creator II
Creator II
Author

Thanks for your reply but its also not working.

pradosh_thakur
Master II
Master II

i changed the format . can you try now. have modified deva's solution too try that out as well.

Learning never stops.
devarasu07
Master II
Master II

Hi,

have your tried all my suggestion? is it working or still issue?

tresesco
MVP
MVP

Try including Master_Code as well in the aggr() like:

=firstsortedvalue(Aggr(Sum(Opening_Qty),Master_Code,New_MasterCode),-aggr(max({<Opening_Qty = {'<>0'}>} %Tran_Date),Master_Code,New_MasterCode))


If this doesn't work, try to share your sample qvw.

swarnendu
Creator II
Creator II
Author

Its not working .

Please check my qvw file

swarnendu
Creator II
Creator II
Author

Please check my qvw file

pradosh_thakur
Master II
Master II

You have %tran_date in the dimension so may be you  have to apply as-of-table approach here.

Learning never stops.
swarnendu
Creator II
Creator II
Author

ya i dont need the date field but if i dont use then i cant explain my problem. so thats why i used it you remove and check the master code 2793

tresesco
MVP
MVP

If you use date field in the chart then use:

Sum(If(%Tran_Date=Aggr(NODISTINCT Max({<Opening_Qty={'<>0'}>} %Tran_Date),MasterCode,New_MasterCode),Opening_Qty,0))

If no date field then:

FirstSortedValue(Aggr(Sum(Opening_Qty),%Tran_Date,New_MasterCode,MasterCode),-Aggr(Only({<Opening_Qty={'<>0'}>}%Tran_Date),%Tran_Date,New_MasterCode,MasterCode))



swarnendu
Creator II
Creator II
Author

Thanks its working but now facing another problem.

when a master code value is zero then its also pick previous value

please look  at my screen shot. look the master code 7473 and 7481.

new.jpg

please suggest me if you have any solution .

Thanks and Regard

Swarnendu.