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

Announcements
Qlik and ServiceNow Partner to Bring Trusted Enterprise Context into AI-Powered Workflows. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
LuisGramillo
Partner - Contributor II
Partner - Contributor II

Using a variable to calculate field Name vs IF condition

Hi everyone,

I'm trying to optimize the performance for a table object. I am currently using AGGR and set analysis as follow:

AGGR(ONLY({<PRESENCE = {$(vPresence)}>} CLIENT_ID),CLIENT_ID)

Where vPresence can be 'YES','NO' or 'YES' , depending on user profile (SECTION ACCESS)
I know that this column may be optimized, and I thought that a solution could be changing the variable to -1 or 0 and making something like:

IF(vNewVariable, CLIENT_ID, CLIENT_ID_ONLY_PRESENCE)

Being CLIENT_ID_ONLY_PRESENCE a copy of CLIENT_ID where PRESENCE = 'YES'

My question is:
Is it better to use a variable to determine the field name? since vPresence depends on the user and not other fields ( is static for each user).

Something like:
=$(=IF(vNewVariable, 'CLIENT_ID', 'CLIENT_ID_ONLY_PRESENCE'))


I don't know if evaluating the if condition by variable is better than a direct if. would it be calculated each row? is there any performance difference between the last two expressions?

Labels (3)
2 Replies
marksouzacosta

Hi @LuisGramillo ,

If you are using Section Access with Data Reduction you don't need those conditions in your Expressions at all. Section Access already handles that. Please take a look at: https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/Scripting/Security/manag...

Search for the section: "Managing user access to specific data in an application"

 

Regards,

Mark Costa

Read more at Data Voyagers - datavoyagers.net
Follow me on my LinkedIn | Know IPC Global at ipc-global.com

Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

Other than what @marksouzacosta  said, we may also need more context of what you are trying to achieve. The sample you provided looks more like option for calculated dimension which can be handled via backend rather than expression. 

cheers

cheers Lech, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful to the problem.