Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
upaliwije
Creator II
Creator II

Date expression

I have 4 date fields in my data model

R_Year, R_month, To_Year,  To_Month

When the use select R_Year and R_Month  I want to calculate premium for To_Year= R_Year +1  and To_Month=R_Month where pol_type='F'

If R_Year=2013 and R_Month=1 result Should be To_Year=2014 and To_Month=1

I have written the following expression but it is not  working. Can some one please look into this and rectify me.

sum( {$<[To_YEAR] = {'$(=max([R_YEAR]+1))'},[To_MONTH]={'$(=max([R_MONTH]))'},POL_TYPE={'F'}>} [PREMIUM] )

10 Replies
Sokkorn
Master
Master

Maybe this one

Sum( {$<[To_YEAR] = {'$(=max([R_YEAR])+1)'},[To_MONTH]={'$(=max([R_MONTH]))'},POL_TYPE={'F'}>} [PREMIUM] )


Regards,

Sokkorn

jagan
Luminary Alumni
Luminary Alumni

Hi,


Try this expression


sum( {$<R_YEAR=, R_MONTH=, [To_YEAR] = {'$(=max([R_YEAR])+1)'},[To_MONTH]={'$(=max([R_MONTH]))'},POL_TYPE={'F'}>} [PREMIUM] )


Regards,

Jagan.

manojkulkarni
Partner - Specialist II
Partner - Specialist II

use variables,

vMaxYear = max([R_YEAR])+1

vMaxMonth = max([R_MONTH])

sum( {<[To_YEAR] = {'$(vMaxYear'},[To_MONTH]={'$(vMaxMonth)'},POL_TYPE={'F'}>} [PREMIUM] )

upaliwije
Creator II
Creator II
Author

Thanks It is still not working Pls help

upaliwije
Creator II
Creator II
Author

It is still not working

upaliwije
Creator II
Creator II
Author

This is not working

upaliwije
Creator II
Creator II
Author

You expression is not working. But It works if delete To_Month Condtion

upaliwije
Creator II
Creator II
Author

Thanks

sum( {$<R_YEAR=, R_MONTH=, [To_YEAR] = {'$(=max([R_YEAR])+1)'},[To_MONTH]={'$(=max([R_MONTH]))'},POL_TYPE={'F'}>} [PREMIUM] )

This expression is not working But If I remove  [To_MONTH]={'$(=max([R_MONTH]))'}, it is working but I don't get the desired result. The results shown is not limited to selected month. Pls help to solve this

jagan
Luminary Alumni
Luminary Alumni

Hi,

Can you attach some sample file?

Regards,

Jagan.