9 Replies Latest reply: Aug 6, 2014 4:55 AM by Mark Munich

how to perform a max min differene and store it in a new field

I am calculating Min of start date and max of enddate and want to store the result in a field.

eg: max(enddate)-min(Startdate) as Result_date.

but ist returning the error.

my ultimate Goal is to calculate the average(Result_date) for several product categories.

Thanks

• Re: how to perform a max min differene and store it in a new field

check if QV regards enddate and startdate as date fields

• Re: how to perform a max min differene and store it in a new field

they are number fields, but ultimately i Need result in date Format or days

• Re: how to perform a max min differene and store it in a new field

then it should work. Do you have a sample app?

• Re: how to perform a max min differene and store it in a new field

This is my requirement

max(enddate)-min(Startdate) as Result_date

and AVG(Result_Date)

avg(max(enddate)-min(Startdate)) as Résult date

does it work or do you have any suggestions.

• Re: how to perform a max min differene and store it in a new field

If you max(enddate)-min(Startdate) the result is not a date, it is a number showing the number of days between the startdate and enddate (provided that QV treats startdate and enddate as dates). Is that what you want to average? In any case, a sample app would help.

• Re: Re: how to perform a max min differene and store it in a new field

Here is a simple sample:

• Re: how to perform a max min differene and store it in a new field

Hi,

I am little confuse can you just tell us.

Regards

• Re: how to perform a max min differene and store it in a new field

Firstly, are you doing this calculation in Script? If yes, use the Group By functions

• Re: how to perform a max min differene and store it in a new field

I tried doing in the script, but it is failing. for example first i want to find the Result time which is Max (Startdate) - Min(Enddate)

which i want to store in the  new field result field, but qv says Expression error.

second Thing is i want to find the average result for each product per day. avg(Resultday)

The first one I have achieved in the frontend using a TextBox, but the second one I am unable to get it.