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: 
Not applicable

Set Analysis Question

How would I write the following as a set analysis -

Sum(if(BusinessTransactionTypeName='NB',(Financials.IP/365)*if($(PictureDate)-AmendedEffectiveStartDate<0,0,RangeMin($(PictureDate)-AmendedEffectiveStartDate,365))))

1 Solution

Accepted Solutions
Not applicable
Author

Ok I see,

this effects of course higher CPU usage.

You can try to combine the first three expressions:

Sum(if(Match(BusinessTransactionTypeName,'NB','NTU','RENEWAL')>0,(Financials.IP/365)*if($(PictureDate)-AmendedEffectiveStartDate<0,0,RangeMin($(PictureDate)-AmendedEffectiveStartDate,365))))

You can also try it like this (Set Expression instead of "MATCH"):

Sum(

     {< BusinessTransactionTypeName={'NB','NTU','RENEWAL'}>}

     (Financials.IP/365)*if($(PictureDate)-AmendedEffectiveStartDate<0,0,RangeMin($(PictureDate)-AmendedEffectiveStartDate,365)))

)

Regards,

Björn

View solution in original post

5 Replies
Not applicable
Author

Can anyone help me with this?

Thanks

Kev.

Not applicable
Author

Hi Kevin,

it is not possible to write your expression into a Set Analysis.

Why do you want to do it?

Regards,

Björn

Not applicable
Author

Hi Bjorn,

Reason is because I have a lot of IF statements in full formula (below) and I have associated this as being the cause of wait times in my document - someone suggested Set Analysis would speed up process - full formula =

Sum(if(BusinessTransactionTypeName='NB',(Financials.IP/365)*if($(PictureDate)-AmendedEffectiveStartDate<0,0,RangeMin($(PictureDate)-AmendedEffectiveStartDate,365))))

+Sum(if(BusinessTransactionTypeName='RENEWAL',(Financials.IP/365)*if($(PictureDate)-AmendedEffectiveStartDate<0,0,RangeMin($(PictureDate)-AmendedEffectiveStartDate,365))))

+Sum(if(BusinessTransactionTypeName='NTU',(Financials.IP/365)*if($(PictureDate)-AmendedEffectiveStartDate<0,0,RangeMin($(PictureDate)-AmendedEffectiveStartDate,365))))

+Sum ( if(BusinessTransactionTypeName='CANCEL',(Financials.IP/(AmendedEffectiveEndDate-AmendedEffectiveStartDate))*

if($(PictureDate)-AmendedEffectiveStartDate<0,0,if($(PictureDate)-AmendedEffectiveStartDate<AmendedEffectiveEndDate-AmendedEffectiveStartDate,$(PictureDate)-AmendedEffectiveStartDate,AmendedEffectiveEndDate-AmendedEffectiveStartDate))))

+Sum ( if(BusinessTransactionTypeName='MTA',(Financials.IP/(AmendedEffectiveEndDate-AmendedEffectiveStartDate))*

if($(PictureDate)-AmendedEffectiveStartDate<0,0,if($(PictureDate)-AmendedEffectiveStartDate<AmendedEffectiveEndDate-AmendedEffectiveStartDate,$(PictureDate)-AmendedEffectiveStartDate,AmendedEffectiveEndDate-AmendedEffectiveStartDate))))

Not applicable
Author

Ok I see,

this effects of course higher CPU usage.

You can try to combine the first three expressions:

Sum(if(Match(BusinessTransactionTypeName,'NB','NTU','RENEWAL')>0,(Financials.IP/365)*if($(PictureDate)-AmendedEffectiveStartDate<0,0,RangeMin($(PictureDate)-AmendedEffectiveStartDate,365))))

You can also try it like this (Set Expression instead of "MATCH"):

Sum(

     {< BusinessTransactionTypeName={'NB','NTU','RENEWAL'}>}

     (Financials.IP/365)*if($(PictureDate)-AmendedEffectiveStartDate<0,0,RangeMin($(PictureDate)-AmendedEffectiveStartDate,365)))

)

Regards,

Björn

Not applicable
Author

Thanks Bjorn, went for the Set Expression, speeded up the calculation significantly.

Regards

Kev.