Qlik Community

Deployment & Management

Discussion board where members learn more about Qlik Sense Installation, Deployment and Management.

Announcements
Now Live: Qlik Sense SaaS Simplified Authoring – Analytics Creation for Everyone: READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
zied_ahmed1
Specialist
Specialist

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:

//  LOAD * FROM (qvd) ;/

// Concatenate:

// LOAD

//     * WHERE  "date"= Today()

//      ;

    // SELECT

car,

actif

date

// FROM Database.table

// ;

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

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

3 Replies
laddu_927
Specialist
Specialist

Zied,

Do something like

count_Actif_1:

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

resident <your table>

where actif=1

group by car,Month(Date);

join (count_Actif_1)

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

resident <your table>

where actif=0

group by car,Month(Date);

Load car,Month,Actif_1/Actif_0 as ratio

resident count_Actif_1;

Drop table count_Actif_1;

Hope i understood you correctly and it helps you.

zied_ahmed1
Specialist
Specialist
Author

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

laddu_927
Specialist
Specialist

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