Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
OrlandoPM
Contributor
Contributor

How to show only max values?

Hi,

I have the following information grouped by the following dimensions

Table A:

DenoConcentrFormaFarmacPresentationCodigoProdQuantity 
ACIDO250 mgTABLETACAPSULACAJA CAPS7800416,830Max Value
ACIDO250 mgTABLETATABLETA RECCAJA TAB4107190 
ACIDO250 mgTABLETATABLETA RECCAJA TAB81721,722 
     Total18,742 
TOXIC500 gmUNIDADPASTTAB15385Max Value
TOXIC500 gmUNIDADPASTCAPS60050 
     Total135 

 

Result:

The result should show the dimensions that correspond to the Max Value in Table A and the quantity is the total value.

DenoConcentrFormaFarmacPresentationCodigoProdQuantity
ACIDO250 mgTABLETACAPSULACAJA CAPS7800418,742
TOXIC500 gmUNIDADPASTTAB153135

 

Please can someone suggest me how to do this?

Thanks

3 Replies
Frank_Hartmann
Master II
Master II

Maybe like this:

tmp:
Load * Inline [
Deno,	Concentr,	Forma,	Farmac,	Presentation,	CodigoProd,	Quantity,	 
ACIDO,	250 mg,	TABLETA,	CAPSULA,	CAJA CAPS,	78004,	16.830	
ACIDO,	250 mg,	TABLETA,	TABLETA REC,	CAJA TAB,	4107,	190	 
ACIDO,	250 mg,	TABLETA,	TABLETA REC,	CAJA TAB,	8172,	1.722	 
TOXIC,	500 gm,	UNIDAD,	PAST,	TAB,	153,	85	
TOXIC,	500 gm,	UNIDAD,	PAST,	CAPS,	600,	50	];  

left join

Load Deno,sum(Quantity) as Sum, max(Quantity) as max Resident tmp Group by Deno; 

NoConcatenate
Final:
Load * Resident tmp Where Quantity =max; DROP table tmp; DROP fields max,Quantity;
OrlandoPM
Contributor
Contributor
Author

Thank you very much @Frank_Hartmann , it works perfectly, but I need both tables as a result, there is a possibility to get the same result using expressions.

MayilVahanan

Hi @OrlandoPM 

Try like below

If(Rank(Aggr(Sum(Quantity), Deno))=1, Sum(Total<Deno> Quantity))

MayilVahanan_0-1616396391626.png

 

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.