Actually I am working on performance optimization.
My intention to understand algorithm/logic behind function is can I apply similar logic in sql while fetching data from source. And I want to compare performance of dashboard when we are using functions in qlikview datamodel with using similar logic in sql.
Great dreamer's dreams never fulfilled, they are always transcended.
In most cases it doesn't really make any big difference whether you calculate things in SQL or in the QlikView script. In both situations, the calculations are made when the script runs.
The big difference is whether you call the function in a UI object, or if you do it in the script. If you call the function in a UI object, the calculation is made every time the user clicks, which of course will influence the performance. But if you do it in the script, the number will be calculated during the script run and then stored.
So, the big question is: Which numbers do you want to be "static" (calculated in the script) and which numbers do you want to be "dynamic" (calculated when the user clicks)?