5 Replies Latest reply: Oct 1, 2013 12:10 PM by vikas mahajan

# 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  !!!!!!!!!!!!!!!!!!!!!!

• ###### Re: How to find out stock for Day for max of date of month

try this.

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

Thanks.

Narender

• ###### Re: How to find out stock for Day for max of date of month

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

• ###### Re: How to find out stock for Day for max of date of month

TRY THIS

in script write this--

MAX(DATE(Stock_Date) AS Stock_Date,

firstsortedvalue(Stock,-Stock_Date) AS Stock

GROUP BY Stock_Date;

Stock_Date,

Stock

FROM TABLE;

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

in expression--

dimension--Stock_Date

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

• ###### Re: How to find out stock for Day for max of date of month

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

• ###### Re: How to find out stock for Day for max of date of month

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

Vikas