Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

qliktech_uk
New Contributor III

Aggregating data using preceding load.

Hi,

Using my first set of QVDs I want to tranform some data and load this at an aggregated level.

My first set of QVDs is at a very low granularity, I have few flags derived at that granularity but would need the data only for flag =1 .

Eg:

QVD at detailed level

Month   Account Num  Flag Amount

  1             xx                      1            10

  1             yy                      0             20

Summary QVD (where flag =1 )

Month            Amount

1                         10

Can I do a preceding load where I have only the data for flag = 1?

Thanks.

Tags (1)
1 Solution

Accepted Solutions
MVP
MVP

Re: Aggregating data using preceding load.

You can also do it like

LOAD Month, Sum(If(Flag=1,Amount)) as AmountFlag1, Sum(If(Flag=0,Amount)) as AmountFlag0

FROM YourQVD (qvd)

GROUP BY Month;

6 Replies
MVP
MVP

Re: Aggregating data using preceding load.

May be like this

LOAD Month,

     Amount

Where Flag = 1;

LOAD Month,

     AccountNum,

     Flag,

     Amount

FROM ...

MVP
MVP

Re: Aggregating data using preceding load.

Try

LOAD Month, Sum(Amount) as Amount

FROM YourQVD (qvd)

WHERE Flag = 1

GROUP BY Month;

Re: Aggregating data using preceding load.

In summary qvd why not

Noconcatenate

Load * Resident DetailQvd Where Flag=1;

qliktech_uk
New Contributor III

Re: Aggregating data using preceding load.

Thank you all.

I realised that there are more measures, some measures I need to bring it for both flag 0 and 1 and some with flag 1.

By using the where flag = 1 wouldnt work in this case.

Whats the best approach at the script level?

Is it a case of doing 2 loads one for flag = 1 and one without and concatenate?

MVP
MVP

Re: Aggregating data using preceding load.

You can also do it like

LOAD Month, Sum(If(Flag=1,Amount)) as AmountFlag1, Sum(If(Flag=0,Amount)) as AmountFlag0

FROM YourQVD (qvd)

GROUP BY Month;

qliktech_uk
New Contributor III

Re: Aggregating data using preceding load.

thanks so much Stefan and others.

Community Browser