Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Shubham_Deshmukh
Specialist
Specialist

Exclude Max value product using script

Hi Qlikers,

It is quite simple but m getting confuse for this in scripts. I want to exclude max value product (D) from my list to show in straight table, I am extracting below data from excel sheet.

PRODUCTValue
A10
C20
D30
E40
E50
D90

Expected output   :

PRODUCTValue
A10
C20
E40
E50

 

Thanks

Labels (2)
1 Solution

Accepted Solutions
tresesco
MVP
MVP

This?

T1:
Load * Inline [
PRODUCT,	Value
A,	10
C,	20
D,	30
E,	40
E,	50
D,	90];

Load
	FirstSortedValue(PRODUCT, -Value) as MaxPROD
Resident T1 ;
T2:	
NoConcatenate
Load * Resident T1 Where Not Exists(MaxPROD,PRODUCT); Drop Table T1; Drop Field MaxPROD;

 

View solution in original post

13 Replies
tresesco
MVP
MVP

Max in aggregate or in individual value?

Shubham_Deshmukh
Specialist
Specialist
Author

Individual value.

If possible let me know both.

tresesco
MVP
MVP

This?

T1:
Load * Inline [
PRODUCT,	Value
A,	10
C,	20
D,	30
E,	40
E,	50
D,	90];

Load
	FirstSortedValue(PRODUCT, -Value) as MaxPROD
Resident T1 ;
T2:	
NoConcatenate
Load * Resident T1 Where Not Exists(MaxPROD,PRODUCT); Drop Table T1; Drop Field MaxPROD;

 

Shubham_Deshmukh
Specialist
Specialist
Author

Thanks Tresesco for reply.
But tt is excluding Product 'E' also.
jyothish8807
Master II
Master II

Hi Shubham,

You can acheive the same from UI a well, using the same logic mentioned by tressesco.

Ref attached.

Best Regards,
KC
Shubham_Deshmukh
Specialist
Specialist
Author

Sorry Jyothish, I cannot open qvw here.
tresesco
MVP
MVP

I got:

Capture.PNG

jyothish8807
Master II
Master II

Try like this:

T1:
Load RowNo() as Si,
PRODUCT,
Value;
Load * Inline [
PRODUCT, Value
A, 10
C, 20
D, 30
E, 40
E, 50
D, 90];

In UI: Create a straight chart:

Dim1: Si

Dim2. =if(PRODUCT<>FirstSortedValue(total PRODUCT, -Value),PRODUCT)

expression:Sum(Value)

You can hide Si field from presentation tab:

Capture.PNG

Best Regards,
KC
Shubham_Deshmukh
Specialist
Specialist
Author

Thanks @jyothish8807 , working absolutely fine but I want to do it in script.

@tresesco , it is working for table box but when I am taking PRODUCT as dimension in straight table it is not showing 'E'.xx.png