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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
risabhroy_03
Partner - Creator II
Partner - Creator II

Set Analysis Issue

I have a field [Max_Invoice_Date_GMT_Updated] that has dates stored for each [Company_Code] as shown below

risabhroy_03_0-1640256861448.png

Now, I want to sum my [Quantity] where [Invoice_Date_GMT_Updated] = [Max_Invoice_Date_GMT_Updated] using set analysis.

I wrote -     Sum({<[Invoice_Date_GMT_Updated] = p(Max_Invoice_Date_GMT_Updated)>}Quantity)

but unfortunately, I am not getting the correct values. I don't want to use it because my data is too large and it might affect my performance.

Please help.

1 Solution

Accepted Solutions
sasikanth
Master
Master

Hi, 

You can try to do this at script level like below to avoid performance hit on the application

MAP:

mapping load

company_code, max([Invoice_Date_GMT_Updated])  as [Invoice_Date_GMT_Updated]

 from CompanyTable;

 

Company:

Load *, if ([Invoice_Date_GMT_Updated] =MaxDate,1,0) as Max_Flag;

Load *,

applymap('MAP',company_code ,'N/A') as MaxDate

from CompanyTable;

 

Chart expression: sum({<Max_Flag={'1'}>}Quantity)

 

Thanks, 

Sasi

 

View solution in original post

1 Reply
sasikanth
Master
Master

Hi, 

You can try to do this at script level like below to avoid performance hit on the application

MAP:

mapping load

company_code, max([Invoice_Date_GMT_Updated])  as [Invoice_Date_GMT_Updated]

 from CompanyTable;

 

Company:

Load *, if ([Invoice_Date_GMT_Updated] =MaxDate,1,0) as Max_Flag;

Load *,

applymap('MAP',company_code ,'N/A') as MaxDate

from CompanyTable;

 

Chart expression: sum({<Max_Flag={'1'}>}Quantity)

 

Thanks, 

Sasi