Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

jim_chan
Contributor III

Set Analysis to display new record in a text box object

HI guys,

I am following this post regarding how to use set analysis for new record. I was following 1 of the sample:

How to check if Record exist in Previous Month ? | Qlik Community

in the straight table expression, it is written as:

IF(COUNT({<batch_year = {'<$(=Max(batch_year))'}, risk_item_id = P({<risk_item_id>})>}risk_item_id)>0,'NO','YES')

I wonder how can i change or convert this line of code to show me amount of new records in text box object.

Rgds,

Jim

14 Replies

Re: Set Analysis to display new record in a text box object

Do you just have risk_item_id as your dimension or more? I am assuming you only have 1, but if you have more than 1, then add that to the aggr function below. This will count all the YESs.

Sum(Aggr(If(Count({<batch_year = {'<$(=Max(batch_year))'}, risk_item_id = P({<risk_item_id>})>}risk_item_id)>0,0,1), risk_item_id))

or this as risk_item_id = P({<risk_item_id>}) is not really needed here

Sum(Aggr(If(Count({<batch_year = {'<$(=Max(batch_year))'}>}risk_item_id)>0,0,1), risk_item_id))

jim_chan
Contributor III

Re: Set Analysis to display new record in a text box object

I have tried this bro.. but it is still giving me 0 value....

What do you mean if i am using only risk_iem_id as dimension or more? any exmaples?

Sum(Aggr(If(Count({<batch_year = {'<$(=Max(batch_year))'}, risk_item_id = P({<risk_item_id>})>}risk_item_id)>0,0,1), risk_item_id))

Re: Set Analysis to display new record in a text box object

Did you try the expression you gave in a straight table? and it gave you the YES at the right places?

jim_chan
Contributor III

Re: Set Analysis to display new record in a text box object

yes bro. with expression:

IF(COUNT({<batch_year = {'<$(=Max(batch_year))'}, risk_item_id = P({<risk_item_id>})>}risk_item_id)>0,'NO','YES')

yes.jpg

jim_chan
Contributor III

Re: Set Analysis to display new record in a text box object

but i just couldnt chnage to and use it on a textbox to diplay me number of new records.

Re: Set Analysis to display new record in a text box object

What all dimensions are there in your chart? Can you list there names?

jim_chan
Contributor III

Re: Set Analysis to display new record in a text box object

Sunny,

straight table chart using 1 calculated dimension:

=IF(NOT IsNull(batch_year),risk_item_id)

Re: Set Analysis to display new record in a text box object

Then this should have worked:

Sum(Aggr(If(Count({<batch_year = {'<$(=Max(batch_year))'}, risk_item_id = P({<risk_item_id>})>}risk_item_id)>0,0,1), risk_item_id))

can you put this expression (next to your current expression for YES and NO) in the straight table and see what you are getting?

jim_chan
Contributor III

Re: Set Analysis to display new record in a text box object

bro, it still gives me zero values. for no and yes.

yes.jpg

Community Browser