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

Announcements
Qlik Connect 2026 Agenda Now Available: Explore Sessions
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

IF ()

Temp_Table
ID
COUNT
LOCATION
SIGR

I'm trying to create a band range from field sigr where count field is maximum count. Below is my logical syntax

IF(SIGR <= 99999 AND COUNT = max(COUNT) ,'A',

IF( SIGR > 99999 AND  SIGR <= 49999 AND COUNT=max(Count),'B' )) as RangeField

Thanks

2 Replies
MayilVahanan

Hi

Try like this

Temp_Table:

Load * from Temp_Table;

Left join(Temp_Table)

Load ID, Max(Count) as CountTemp resident Temp_Table group by ID;

Load *,

IF(SIGR <= 99999 AND COUNT = CountTemp  ,'A',

IF( SIGR > 99999 AND  SIGR <= 49999 AND COUNT=CountTemp ,'B' )) as RangeField

resident Temp_Table;

Drop table Temp_Table;

Drop field CountTemp;

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

Header 1Header 2Header 3Header 4Header 5
IDCOUNTLOCATIONSIGRVALUE
AA2301UK1000045000
AA2302UK1500056000
AA2303UK50065000

By your model (scripts);

The last row will be selected since it has the Max count, the range will be A since it less then 99999 and it's corresponding value that is 65000, unfortunately that is not the desired result.

I had wanted the summation for all the value that is 45000 + 56000 + 65000 this particular range field. Tried to SUM the value field as way but didnt get it.


Thanks