Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
gauthamchilled
Creator
Creator

Alternate for expression to tune performance

if([Report Flag]='y',
-if([RA Type]=AccType,[BalanceYTD],-[BalanceYTD]),
if([RA Type]=AccType,[BalanceYTD],-[BalanceYTD]))

Report Flag and RA Type are from table 1 and BalanceYTD and RA Type are from other table. Both tables are linked by an other table.
I am using the above expression in a variable and used in most of the charts in my dashboard along with set analaysis.

Is there a way to handle this to optimize the performance of this expression.

Can i handle in scrip, if so may i know how to do?

Thanks
Gautham

3 Replies
marcus_sommer

If I understand it right you queries the flag and type to set the BalanceYTD positive or negative. This could be done within the script by creatin (an additionally) flag-field to your BalanceYTD which contains 1 or -1 (matching between both tables per mapping and applymap: Mapping as an Alternative to Joining) and then within your calculations xou could use something like: sum(BalanceYTD * FlagBalanceYTD) which would be a lot more performant as the if-loops.

- Marcus

SreeniJD
Specialist
Specialist

As Marcus suggested,

Use ApplyMap (Mapping) instead of Join.

Please share sample qvw, it will help us to provide quick solution.

Regards,

Sreeni

gauthamchilled
Creator
Creator
Author

Hi Marcus,

Can you explain with a simple example please?