4 Replies Latest reply: Jan 31, 2018 3:53 AM by Stefania Santalucia

# Create QVD file and sum of measurement

Hi All

I have  a question for you:

I created a QVD file from csv file; then I did a sum of measurement to reduce a number of record .

I have to add a "if conditions" to create subgroups.

for example:

I have AGE (in year) and I have to create age classes (0-10 --> 1st class) ecc....

Should I group together when I create QVDs or when I do the SUM?ù

Thanks.

• ###### Re: Create QVD file and sum of measurement

Hi

you can using Qlik Class function or If condition to create subgroups

Example

Using Class

```[Sheet1]:
LOAD class([Age],10,' Age ') as AgeGroup,
count([ID]) as countnum

FROM [lib://Desktop/TestClass.xlsx]
(ooxml, embedded labels, table is Sheet1)
group by class([Age],10,' Age ') ;
```

Using If condition

```[Sheet1]:
if([Age] <=10, '1 to 10'
,if ([Age] <=20, '11 to 20'
,if ([Age] <=30, '21 to 30', 'Above 30'))) as AgeGroup
,count([ID]) as countnum

FROM [lib://Desktop/TestClass.xlsx]
(ooxml, embedded labels, table is Sheet1)
group by
if([Age] <=10, '1 to 10'
,if ([Age] <=20, '11 to 20'
,if ([Age] <=30, '21 to 30', 'Above 30')));
```

An Pham

• ###### Re: Create QVD file and sum of measurement

Hi,

I have another question:

this conditions  (if and class)  that you give me, from a technical point of view, is it better to use them when I create qvd or when I add up?

Thanks.

• ###### Re: Create QVD file and sum of measurement

Personally I tend to do things like this in the QVD generator script.

• The QVD fields / values become a single version of the truth that can be used in multiple qvf apps
• Less processing is needed in the qvf app which should mean better performance
• ###### Re: Create QVD file and sum of measurement

Thank you for you help!