3 Replies Latest reply: Apr 13, 2017 6:05 AM by Shiva Nagesh Bodepudi

# Calcul average per month

Hello i need to calculate average of actif car per month :

i used a QVD who stock a field  named actif need to historise it everyday to know if the car is actif or not (if this field =1 it will be actif for this date)

in the end of the month i need to calculate the ratio between all car and the actif one per month and this is the QVD used :

//  QVD_actif:

// Concatenate:

//     * WHERE  "date"= Today()

//      ;

// SELECT

car,

actif

date

// FROM Database.table

// ;

// // ////*********store QVD**************

//  STORE [QVD_actif] into [\$(vQvdPath)\QVD_actif.qvd](qvd);

• ###### Re: Calcul average per month

Zied,

Do something like

count_Actif_1:

Load car,Month(Date) as Month,count(1) as Actif_1

where actif=1

group by car,Month(Date);

join (count_Actif_1)

Load car,Month(Date) as Month,count(1) as Actif_0

where actif=0

group by car,Month(Date);

resident count_Actif_1;

Drop table count_Actif_1;

Hope i understood you correctly and it helps you.

• ###### Re: Calcul average per month

yes,just in QVD i need how to stock the field value per day

• ###### Re: Calcul average per month

You need month level ratio to be stored against the date??