Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to differentiate between columns used at different instances?

Hi friends,

I have a student.qvd file. I have to display 2 reports. They are:

1) Student with id>150

2) Students whose address is not equal to India

I have written the following code:

report1:

load   student.name,

          student.address,

          student.id

FROM

(qvd) where student.id>150;

report2:

load   student.name,

          student.address,

          student.id

FROM

(qvd) where student.address<>'India';

Now, how i have to differentiate between student names between 2 reports?

Any help is greatly appreciated?

1 Solution

Accepted Solutions
Not applicable
Author

Hi,

You could give the first query as

load   student.name as Student1,

          student.address,

          student.id

FROM

(qvd) where student.id>150;

and second as

load   student.name as Student2

          student.address,

          student.id

FROM

(qvd) where student.address<>'India';

Then, in one chart, populate Student1 and Student2 in the other.

Regards,

Anju

View solution in original post

8 Replies
nirav_bhimani
Partner - Specialist
Partner - Specialist

HI,

Try this Code.

report1:

load   student.name,

          student.address,

          student.id,

          'Top150' as Source     

FROM

(qvd) where student.id>150;

report2:

load   student.name,

          student.address,

          student.id,

           'Address' as Source 

FROM

(qvd) where student.address<>'India';

On the basis of Source you can differentiate.

Regards,

Nirav Bhimani

Gysbert_Wassenaar

Load all the data into one table and do the filtering in the reports. If you have QV11 this is very easy by defining Alternate States for the different charts.


talk is cheap, supply exceeds demand
Not applicable
Author

Thanks Nirav for your reply,

But i don't want to display 'Source' in the report. Moreover, i want to display  2 different reports 

Not applicable
Author

Hi Gysbert, i am very new to QV and yes, my version is QV11.

Can you please elaborate your answer?

Not applicable
Author

Hi,

You could give the first query as

load   student.name as Student1,

          student.address,

          student.id

FROM

(qvd) where student.id>150;

and second as

load   student.name as Student2

          student.address,

          student.id

FROM

(qvd) where student.address<>'India';

Then, in one chart, populate Student1 and Student2 in the other.

Regards,

Anju

nirav_bhimani
Partner - Specialist
Partner - Specialist

You can Write Set Expression as,

Count ( {<Source= {'Top150'} >} name )  // For Report1

Count ( {<Source= {'Address'} >} name )  // For Report2

No need to display in front end.

Regards,

Nirav Bhimani

Not applicable
Author

Thanks Anju. It worked well.

Similarly do i have to do for address and id?

Can't i define the entire "load block" with any variable?

Not applicable
Author

No, you don't have to do it for address and id .....it will automatically populate the correct address and id.

We can't define an entire block with a Load variable. But, I guess qlikview somehow 'remembers' which query is responsible for a variable

Regards,

Anju