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: 
nevilledhamsiri
Specialist
Specialist

How to seperate two fields from the combination of two dimnsions!

Hi,

I need to make a list box for new & renewals from the data given below. Once I loaded this sample data with reference to  policy_ no & period from date , i need to separate what is new & renewals. The year from policy_no & the month from period from date to be considered in separating what policies are NEW & what are RENEWALS. (17,14,15,16  are the years as per the policy number but some policy numbers of which length equals to 12, the Year of which is the 1st two letters eg,     04RT1B001008, carries Year as 2004. Once the Year is extracted, 2017 refers to new, all years below 2017 refers to as Renewals. But 2016 yer policies to be matched with period from date. Since this list carries the policies refunded in July, If the Year is 2016, & period from date equal to July & below need to consider as renewals. Eg if the Year of the policy is 2016 & period from date falls in to July  & below they are renewals & year is 2016 & from date is above July (Aug to Dec) to be considered as New.


Expect our expert to suggest me an answer for this. If this can be done in the script it is fine because I can make two different fields such as new & renewals.


Thanks


Neville

BRANCHCLASS_CODEPRODUCT_CODEPOLICY_NONAME_OF_INSUREDCREDIT_NOTE_NOCREDIT_NOTE_DATEPERIOD_FROMPERIOD_TOPREMIUM
RA00MC1DRA00171D0004042MRS. P.G.R.S. KUMARIRA0017C000925713-Jul-171-Feb-1731-Jan-18-21339.5
RA00MC1ARA00171A0002832MR. M.A. PIYARATHNARA0017C00092153-Jul-174-May-173-May-18-73828.13
RA00M44FRA00144F0000101MR. H.T. PRIYANTHARA0017C000924410-Jul-1726-Mar-1725-Mar-18-6351.05
RA00MC1XRA00141X0000973Mrs U.W. NANDAWATHIRA0017C000923710-Jul-179-May-178-May-18-10207.5
RA00MC1CRA00151C0002988MR. D.J. NIRANJAN.RA0017C000927418-Jul-1711-Feb-1710-Feb-18-24039.11
RA00MC1DRA00161D0003943MRS K.H.S. JAYAWARDHANARA0017C000925513-Jul-1730-Mar-1729-Mar-18-23211.5
RA00MC1ARA00161A0002549MR. A.D. MADUSHANKARA0017C000928621-Jul-1718-Jan-1717-Jan-18-91821.07
RA00MC1B04RT1B001008MR. M.K. SIRIWARDNARA0017C000924210-Jul-1726-Mar-1725-Mar-18-34032.44
RA00FRDFRA0015DF0001542MR. M.A. NIMALRA0017C000925012-Jul-1713-May-1713-May-18-4497.98
RA00MC1ARA00141A0002115MR. W.D. WEERAKOONRA0017C000925412-Jul-173-Jul-172-Jul-18-5062.5
RA00MC1ARA00161A0002593Mr B.A ANURA WICKRAMASINGHERA0017C000924711-Jul-1728-Mar-1727-Mar-18

-34842.22

15 Replies
nevilledhamsiri
Specialist
Specialist
Author

Dear Vinayak! & all our experts;

This is how I loaded data but error comes as given below!

Also my requirement is as follows:

To arrange a separate field for new & renewal

All policies which carry 2017 (Year which carries 17) need to be considered as New

2015 & below needs to be Renewals

The issue is only 2016. To break 2016 policies in to New & Renewals becomes little challenging! That should  be as follows:

If the Credit note date January 2017, all 2016 policies needs to be considered as New

If the credit note date is February 2017  & the policies of 2016 with their period from date falls in to  January requires to be treated as Renewal (Cancelled a policy in February 2017 due to 2016 January policy)

If the credit note date is March 2017 & the policies of 2016 with their period from date falls in to  January & February requires to be treated as Renewals ( Cancelled  a policy in March 2017 due to 2016 Jan & Feb policies)  & this pattern needs to be continued to be up to December & in  December again  policies cancelled in December 2017  of policies due to 2016 Nov & below requires to be renewals) If I am to sum up this it should look like below

A: All policies due to 2017 (NEW)

B :All policies due to 2015 & below (2015,2014,2013,2012 etc) (RENEWALS)

C :Always refunded policies in 2017 due to 2016, (To be arranged as per above pattern see it again below)

Credit note date               Period from Date

2017_Jan                         No Renewals (2016) but all 2016 policies should be New

2017-Feb                         Renewals (2016 Jan policies) others(Feb_Dec) in 2016 New

2017-Mar                         Renewals (2016 Jan+Feb) others(Mar_Dec) in  2016 New

2017-Apr                         Renewals (2016 Jan+Feb+Mar)  others (Apr_Dec) in 2016 New

2017_May                       Renewals (2016 Jan+Feb+Mar+Apr) others (May_Dec) in 2016 New

Like wise this combination will continue & in December again Dec _Dec in 2016 only will remain new.

Please refer this pattern & combination & suggest an if statement in the script to create a field for New & Renewals. If this expression can be made as an expression  no harm but wish to have a separate field for new & Renewals

Thanks In Advance

Neville

REFUNDS:

LOAD BRANCH, CLASS_CODE, PRODUCT_CODE, POLICY_NO, NAME_OF_INSURED, CREDIT_NOTE_NO,

     CREDIT_NOTE_DATE, PERIOD_FROM, PERIOD_TO, PREMIUM, ADDRES, REASON, FINANCIAL_INTEREST,

     ME_CODE, ME_NAME,

    

if((num(month(date(date#(PERIOD_FROM,'DD-MMM-YY'),'DD-MM-YYYY'))))>6 and (num(year(date(date#(PERIOD_FROM,'DD-MMM-YY'),'YYYY'))))=2017  ,'New','Renewed') as Date_From

RESIDENT REFUNDS

    

    

FROM (biff, embedded labels, table is Sheet1$);

  

Table not found error

Table 'REFUNDS' not found

REFUNDS:

LOAD BRANCH, CLASS_CODE, PRODUCT_CODE, POLICY_NO, NAME_OF_INSURED, CREDIT_NOTE_NO,

     CREDIT_NOTE_DATE, PERIOD_FROM, PERIOD_TO, PREMIUM, ADDRES, REASON, FINANCIAL_INTEREST,

     ME_CODE, ME_NAME,

    

if((num(month(date(date#(PERIOD_FROM,'DD-MMM-YY'),'DD-MM-YYYY'))))>6 and (num(year(date(date#(PERIOD_FROM,'DD-MMM-YY'),'YYYY'))))=2017  ,'New','Renewed') as Date_From

RESIDENT REFUNDS

    

    

FROM (biff, embedded labels, table is Sheet1$)

vinayakg
Contributor III
Contributor III

nevilledhamsiri Try this one,

New:

Load

BRANCH, CLASS_CODE, PRODUCT_CODE, POLICY_NO, NAME_OF_INSURED, CREDIT_NOTE_NO, CREDIT_NOTE_DATE, PERIOD_FROM, PERIOD_TO, PREMIUM,

if(((num(month(date(date#(CREDIT_NOTE_DATE,'DD-MMM-YY'),'DD-MM-YYYY'))))<=(num(month(date(date#(PERIOD_FROM,'DD-MMM-YY'),'DD-MM-YYYY'))))) and (num(year(date(date#(CREDIT_NOTE_DATE,'DD-MMM-YY'),'YYYY'))))<=(num(year(date(date#(PERIOD_FROM,'DD-MMM-YY'),'YYYY'))))-1 ,'Renewed','New') as Status

Resident Policy;

nevilledhamsiri
Specialist
Specialist
Author

Dear Vinayak,

Could you please send me your working & resulted pivot table. I cannot read out your qvw data since I am having  A Personnel edition.

Regards

Neville

vinayakg
Contributor III
Contributor III

Hi nevilledhamsiri

Sorry for the delay,

i have attached screenshots of code and resulting table, Please do find the attachments.

Thanks and regards,

Vinayak

nevilledhamsiri
Specialist
Specialist
Author

Dear Vinayak,

The expected out put has not come. All policies below 2016 needs to be Renewals. 2017 policies needs to be New. 2016 policies are broken in to both New & Renewals. Please see my data summery  what I have presented. Please modify your formula to acomodate that.

Thanks Neville

vinayakg
Contributor III
Contributor III

I am Not getting scenario, Can u please explain me what all we need to consider for comparison and which all years and months should show the new and renewed.

if with one small example is appreciated,

regards,

Vinayak