Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to find out stock for Day for max of date of month

Hi Folks,

Many Thanks in advance to see look over it this post.

I stuck in a sitution. i ll explain it below

I have dimension as Month [ jan , feb , March , Apr , May , June , July , Aug ,..., Dec ]

I have on Field Stock_Date in which i have dates for all year and have another field as Stock having  Stock value according dates.

All i want is to calculate : Sum of Stock for max Date of that month

Ex:  Stock_Date  Stock

         01-01-2013  12

         03-01-2013  15

        26-01-2013  18

        26-01-2013  20

So I want to show Sum of Stock on Max of Stock_Date ie: 26-01-2013  means 38 i want as result on selecting Jan.

I want to show this info in Bar Chart so Month is My dimesion and Want expression which show result as i told above.

If have any doubt please let me know i ll explain.

Many Thanks In advance  !!!!!!!!!!!!!!!!!!!!!!


5 Replies
narender123
Specialist
Specialist

try this.

=Sum({<Month={$(=max(Month))},Stock_Date={$(=max(Stock_Date))}>}Stock)

Thanks.

Narender

Not applicable
Author

TRY THIS

in script write this--


LOAD
MAX(DATE(Stock_Date) AS Stock_Date,

firstsortedvalue(Stock,-Stock_Date) AS Stock

GROUP BY Stock_Date;

LOAD

Stock_Date, 

Stock

FROM TABLE;

**********************************

in expression--

dimension--Stock_Date

expression--Aggr(firstsortedvalue(Stock,-Stock_Date) ,Stock_Date)

Not applicable
Author

Sorry to say but both expression is not working.

Issue is while selecting working with

=Sum({<Month={$(=max(Month))},Stock_Date={$(=max(Stock_Date))}>}Stock)

Is need to select Date from Stock_Date then only it's showing , But i want it to show only on selection of Month.

Thanks

QV Help

Not applicable
Author

Hi

Many thanks for you quick reply to all.

I am trying to do thing you suggested.

I ll get back to you guys with result thanks again for help.

Thank

QV Help 

vikasmahajan

Hello if your problem is resolved mark as correct ans so that other developer could use this code for development

Vikas

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.