Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Learn how to migrate to Qlik Cloud Analytics™: On-Demand Briefing!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

max in condition

hi

i have table like this:

OrderSpecificationDim_KeyTypeCheekDim_KeyadSanadId
13910023172026886
1391002317329402
13910023182026888
13910023192026890
13910023192329611
1391002320351628
13910023202329609
13910023202026892

i need too show TypeCheekDim_Key for any OrderSpecificationDim_Key forthe max value of adSanadId

for example when OrderSpecificationDim_Key=1391002320 i should show 3 because it has the biggest value of adSanadId. i have wrote :

if ( (Aggr(max([Ad Sanad Id]),[Id Order])=[Ad Sanad Id]),[Type Check Dim Key],0 )

but it is not true it seem. any one can help me?

31 Replies
anbu1984
Master III
Master III

=FirstSortedValue(TypeCheekDim_Key,-adSanadId)

Not applicable
Author

hi anbu

it doesn't work

JonnyPoole
Former Employee
Former Employee

In this example, i'm using a chart expression to filter for just the records for the largest adSanaid within OrderSpecificationDim_Key

Capture.PNG.png

anbu1984
Master III
Master III

Can you post sample qvw. Check my qvw

Not applicable
Author

hello jonathan

sorry i cant open it because of license limitations, would you please write the code here?

JonnyPoole
Former Employee
Former Employee

Add the OrderSpecificationDim_Key and adSanadId  field   as dimensions in a straight table and then add an expression with this formula :

if ( max( total <OrderSpecificationDim_Key> adSanadId) =adSanadId , TypeCheekDim_Key)

and the load script was nothing special:

LOAD OrderSpecificationDim_Key,

     TypeCheekDim_Key,

     adSanadId

FROM

[http://community.qlik.com/thread/137133]

(html, codepage is 1252, embedded labels, table is @1);

antoniotiman
Master III
Master III

Hi Mana,

see attachment.

Regards,

Antonio

Not applicable
Author

hello Antonio

sorry i cant open it because of license limitations, would you please write the code here?

antoniotiman
Master III
Master III

I have used calculated dimension :

=Aggr(If(Max(TOTAL adSanadId)=adSanadId,OrderSpecificationDim_Key),OrderSpecificationDim_Key,adSanadId,TypeCheekDim_Key)