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

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Logical Help

Any one pls explain the logic after sum function

Num( If(vLanguage = 'EN',  If(%Condition_WellCluster_EN = 'Injection_Volume', Sum({<Well.Name*=Well_Cluster_1::Well.Name>} TW_SP_BO.Injection_Volume), If(%Condition_WellCluster_EN = 'Withdrawal_Volume', Sum({<Well.Name*=Well_Cluster_1::Well.Name>} TW_SP_BO.Withdrawal_Volume),  If(%Condition_WellCluster_EN = 'Water_Production', Sum({<Well.Name*=Well_Cluster_1::Well.Name>} TW_SP_BO.Water_Production), If(%Condition_WellCluster_EN = 'Specific_Water_Production', Alt( Sum( {< Well.Name*=Well_Cluster_1::Well.Name, TW_SP_BO.Withdrawal_Volume={">10000"}, TW_SP_BO.Water_Production={"<200"} >} TW_SP_BO.Water_Production*1000) / Sum( {< Well.Name*=Well_Cluster_1::Well.Name, TW_SP_BO.Withdrawal_Volume={">10000"}, TW_SP_BO.Water_Production={"<200"} >} TW_SP_BO.Withdrawal_Volume/1000) , 0) )))), If(%Condition_WellCluster_DE = 'Injection_Volume', Sum({<Well.Name*=Well_Cluster_1::Well.Name>} TW_SP_BO.Injection_Volume), If(%Condition_WellCluster_DE = 'Withdrawal_Volume', Sum({<Well.Name*=Well_Cluster_1::Well.Name>} TW_SP_BO.Withdrawal_Volume),  If(%Condition_WellCluster_DE = 'Water_Production', Sum({<Well.Name*=Well_Cluster_1::Well.Name>} TW_SP_BO.Water_Production), If(%Condition_WellCluster_DE = 'Specific_Water_Production', Alt( Sum( {< Well.Name*=Well_Cluster_1::Well.Name, TW_SP_BO.Withdrawal_Volume={">10000"}, TW_SP_BO.Water_Production={"<200"} >} TW_SP_BO.Water_Production*1000) / Sum( {< Well.Name*=Well_Cluster_1::Well.Name, TW_SP_BO.Withdrawal_Volume={">10000"}, TW_SP_BO.Water_Production={"<200"} >} TW_SP_BO.Withdrawal_Volume/1000) , 0) )))) ) , '#.##0,'& Repeat('#', 2))

2 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

Break this horrible, complex expression into its component parts and see and understand how they work. then reassemble the parts step by step until you understand the complete expression.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
arasaraja_cts
Partner - Contributor III
Partner - Contributor III

Hi,

A little formatting will help us to understand better,

Picture1.png

  First check if Language is EN if yes execute first block else second block.

  Within the first block there are four if statements first three are straight forward and the fourth one is in the below format

  Alt(sum(expression) / sum(expression) ,0 )

Thanks

Raja.