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

Announcements
Posting on Qlik Community is temporarily paused. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

DISTINCT application_no

count(DISTINCT application_no If(new_dates=settled_dates,'Y'))

what is the best way to do this calculation in an expression

Labels (1)
1 Solution

Accepted Solutions
sunny_talwar
MVP
MVP

Try this:

=Count(DISTINCT If(new_dates = settled_dates, application_no))

HTH

Best,

S

View solution in original post

6 Replies
peter_turner
Partner - Specialist
Partner - Specialist

Hello,

As this is an expression in your UI you could use Set Analysis to perform this, such as

count(DISTINCT {$<new_dates=settled_dates>} application_no)

This will work when you have values selected in your new_dates field, but wont work if your new_dates field doesn't have spaces.

(also the above expression might show with an error by the syntax checker in the expression editor, best to confirm the number in a simple text box whilst developing it)

sunny_talwar
MVP
MVP

Try this:

=Count(DISTINCT If(new_dates = settled_dates, application_no))

HTH

Best,

S

Not applicable
Author

you guys rock, the code work for what i want to do

sunny_talwar
MVP
MVP

Awesome, I am glad we were able to help.

I would suggest closing the thread by marking it correct for whichever solution worked for you the best.

Best,

S

Not applicable
Author

Hi

Check With the expression

count(DISTINCT {$<new_dates=settled_dates>} application_no)----Wrong Expression

=Count(DISTINCT If(new_dates = settled_dates, application_no)) --- Correct Expression

It Will work

peter_turner
Partner - Specialist
Partner - Specialist

Both expressions actually work, but it depends where you're using them, such as text boxes or a chart.

For example the expressions without SetAnalysis will give a result in a text box where no selections are made (like a total version), but the SetAnalysis expression will only produce a value when you make a selection on the first field new_dates.

Both good examples