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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
upaliwije
Creator II
Creator II

Expression

sum( {$<To_YEAR=,[To_MONTH]{'<$(=Max([R_MONTH]))'}>} [PREMIUM] )

I have  written the above expression and it is not working. Pls check my attached document see what is wrong.

What I want to calculate is sum of Premium for the selected period and importantly To_month<R_Months

1 Solution

Accepted Solutions
er_mohit
Master II
Master II

Try this

sum(if(num(To_MONTH)<num(R_MONTH),PREMIUM))

or

sum( {<[To_MONTH]={'<$(=Max([R_MONTH]))'},To_YEAR>} [PREMIUM] )

View solution in original post

4 Replies
albertovarela
Partner - Specialist
Partner - Specialist

You were missing an equal sign after the To_MONTH

sum( {$

  <

   To_YEAR      =

  ,To_MONTH   = {'<$(=Max([R_MONTH]))'}

  >

  } [PREMIUM] )

upaliwije
Creator II
Creator II
Author

Thanks for your reply

But still it is not working. Can U pls check with my document reply to me  with attachment

Thanks

er_mohit
Master II
Master II

Try this

sum(if(num(To_MONTH)<num(R_MONTH),PREMIUM))

or

sum( {<[To_MONTH]={'<$(=Max([R_MONTH]))'},To_YEAR>} [PREMIUM] )

Peter_Cammaert
Partner - Champion III
Partner - Champion III

If you want to sum() all values for To_MONTHs lower than R_MONTH, then why put To_MONTH as a dimension in your chart? Remove the dimension, correct the expression as suggested before and it will work.

Peter