Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
rlawton1
Contributor III
Contributor III

Variable in chart expression being ignored

I have a table chart and some of the measures uses a expression to calculate the result, the expressions use a variable which is set via an input box, it just stores a numeric value.  One of the expression does not change when the variable is changed, and commenting out the variable has no effect so it clearly just being ignored.

This is the expression i want to use:

 

(
  Sum(Incurred_IBNR)    
  +    
  (
    IF(count(Incurred_IBNR)>=1,0, 
      IF(ROUND(Sum(Earn_Net)/Sum(net_to_uw),0.01)=1,0,        	        
        ( 
          (SUM((Incurred_IBNR)*1.03)-Sum(Incurred_IBNR))
           *
          '$(vPercentage)'
        )* (1- (Sum(Earn_Net)/Sum(net_to_uw)))
      )
    ) 
  )   
)/Sum(Earn_Net)

 

 

If i remove the initial IF statement then the variable is used in the calculation:

 

(
  Sum(Incurred_IBNR)    
  +    
  (
    IF(ROUND(Sum(Earn_Net)/Sum(net_to_uw),0.01)=1,0,        	        
      ( 
        (SUM((Incurred_IBNR)*1.03)-Sum(Incurred_IBNR))
         *
        '$(vPercentage)'
      )* (1- (Sum(Earn_Net)/Sum(net_to_uw)))
    )
  )   
)/Sum(Earn_Net)

 

 

the issue is not caused by just being in a nested IF statement as i have tried a dummy nested IF scenario and its works. 

Can anybody shed any light in why this expression does not take the variable into account?

Labels (1)
1 Solution

Accepted Solutions
sunny_talwar

Your if condition is true which is forcing your expression to be 0

IF(count({$<hcc={1}>}inc) >= 1,0,
IF(ROUND(Sum(earned)/Sum(n2u),0.01)=1,0,
( (SUM(TOTAL (inc)*1.03)
-
Sum(TOTAL inc))
*
'$(vPercentage)'
)
* (1- (Sum(earned)/Sum(n2u)))
))

image.png

View solution in original post

3 Replies
sunny_talwar

It would be difficult to look just the expression and know what is going wrong. Would you be able to share a sample so that we can check it out a little more?

rlawton1
Contributor III
Contributor III
Author

I have attached a stripped down example, if you change the variable vPercentage you will see one of the results changes and the other does not even though it should do.

sunny_talwar

Your if condition is true which is forcing your expression to be 0

IF(count({$<hcc={1}>}inc) >= 1,0,
IF(ROUND(Sum(earned)/Sum(n2u),0.01)=1,0,
( (SUM(TOTAL (inc)*1.03)
-
Sum(TOTAL inc))
*
'$(vPercentage)'
)
* (1- (Sum(earned)/Sum(n2u)))
))

image.png