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

Announcements
ALERT: QlikView server communication interruptions following Microsoft Windows Domain Controller security updates
cancel
Showing results for 
Search instead for 
Did you mean: 
n1ef5ng1
Creator
Creator

sum(if.... not working

Hi gurus,

I have this code on my expression

Sum( IF(Transit_Container_Class = 'F' and TXIT_Group_Country.Discharge = $(=(Group_Country)), Transit_TEU,0) ))

                - Before( Sum (IF(Transit_Container_Class = 'F' and TXIT_Group_Country.Discharge = $(=(Group_Country)), Transit_TEU,0))

When user select a country from the field group_country, the expression will read the value and place it on TXIT_Group_Country_Discharge.

it seems that it doesn not read the value as the output does not include that particular TXIT_Group_Country_Discharge

is there something to do with adding a $ in front of the expression?

for normal expression such as

(sum({$<Transit_Container_Class = {'F'},TXIT_Group_Country.Discharge ={$(=(Group_Country))

it works with a $<. but right now my sum statement comes with if, i am clueless on how it is to be done. thanks

Labels (1)
2 Replies
n1ef5ng1
Creator
Creator
Author

anybody know how to do set analysis using sum(if(

n1ef5ng1
Creator
Creator
Author

My full expression code :

=if( Before( Sum (IF(Transit_Container_Class = 'F' and TXIT_Group_Country.Discharge = $(=(Group_Country)) and Transit_TEU>=0, Transit_TEU,1)) , 0)  = 0
  OR IsNull( Before( Sum (IF(Transit_Container_Class = 'F' and TXIT_Group_Country.Discharge = $(=(Group_Country)) and Transit_TEU>=0, Transit_TEU,1)) , 0)) = -1, null(),
if( MonthEnd ( MAX( Date ) ) <> var_EndDate AND MonthEnd( MAX ( Date ) )
= MonthEnd( var_EndDate ) ,

                Sum( IF(Activity_Code = 'DISC' and Derived_Container_Class_Name = 'LADEN' and Derived_Status <>'LRSHP', TEU,0)) / Day( var_EndDate ) * Day(MonthEnd( MAX ( Date ) )) ,
                Sum( IF(Transit_Container_Class = 'F' and TXIT_Group_Country.Discharge = $(=(Group_Country)), Transit_TEU,0) ))
                - Before( Sum (IF(Transit_Container_Class = 'F' and TXIT_Group_Country.Discharge = $(=(Group_Country)), Transit_TEU,0)) )
                )