Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Where Clause

I am new to Qlikview and I am trying to create an expression that counts the number of times a certain [Material] number has the same [Document] number as another certain [Material] number.

Each time a vehicle is sold, the purchase is given a [Document] number. The [Document] number is given to each part [Material] that was sold along with actual vehicle [Material] number. So, a [Document Number] is given to a vehicle [Material] and to each part [Material] when they are sold with.

Here is an example:

Document MaterialDescription
12345618566G01vehicle
12345628489part1
12345652587part2
12345633742part3

I'm looking for an expression that will count the number of times a part number is associated with a vehicle through a document number.

1 Solution

Accepted Solutions
effinty2112
Master
Master

Hi Brett,

In your script you could split the table into two using the Description field to differentiate between vehicles and parts or use the Material code if there is a logic you can apply there:

Document

Vehicle Material Code

Vehicle Description

12345

618566G01

vehicle

and

   

Document

Part Material Code

Part Description

12345

628489

part1

12345

652587

part2

12345

633742

part3

Then a selection on Part Material Code will associate with Vehicle Material Code via the Document field.

Cheers

Andrew

View solution in original post

8 Replies
vishsaggi
Champion III
Champion III

Try This may be?

= Sum(Aggr(Count(Material), Material, Document))

sunny_talwar

What is the expected output here?

Not applicable
Author

I need to count the number of times each part number is associated with each vehicle number using the document number.

vishsaggi
Champion III
Champion III

What is your expected output based on the sample data provided in your first thread?

vishsaggi
Champion III
Champion III

Based on your sample is this what you are looking for?

LOAD * INLINE [

Document, Material, Description

12345, 618566G01, vehicle

12345, 628489, part1

12345, 652587, part2

12345, 633742, part3

12345, 633742, part4

12345, 633742, part5

];

Capture.PNG

effinty2112
Master
Master

Hi Brett,

In your script you could split the table into two using the Description field to differentiate between vehicles and parts or use the Material code if there is a logic you can apply there:

Document

Vehicle Material Code

Vehicle Description

12345

618566G01

vehicle

and

   

Document

Part Material Code

Part Description

12345

628489

part1

12345

652587

part2

12345

633742

part3

Then a selection on Part Material Code will associate with Vehicle Material Code via the Document field.

Cheers

Andrew

Not applicable
Author

I believe this is what I'm looking for.. I can differentiate vehicles and parts using the string 'G01'. I'm assuming I do this through the use of the subfield function in the script correct?

effinty2112
Master
Master

Hi Brett,

Subfield is not the function to use in a where clause. You have a choice. Two suggestions:

WHERE Right(Material,3) = 'G01'

or

WHERE Wildmatch(Material, '*G01')


Good luck


Andrew