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: 
eigorman
Partner - Contributor II
Partner - Contributor II

Count IF and Distinct Load

I am pulling together a load script for metrics reporting. I can do the consolidation of data in an expression

=

Count(DISTINCT{<[RTC Score]={'RED'}>}[Recovery Plan Name]

)

Then I take the totals I have in expressions

=(PlanTot-RTCSR)/PlanTot


The data I am using to bring in the score for a measurement . I bring in the RTC Score  and the Recovery Plan Name fields from a resident load.

RTC:

Load [Recovery Plan Name],
[RTC Score] as RTCS,
Count(DISTINCT(IF([RTC Score]='RED',[Recovery Plan Name])))
Resident QLIK;

///// IF([RTC Score]='RED', count(Distinct[Recovery Plan Name])) as RTCS2

I am new to Qlik and still learning.


3 Replies
Gysbert_Wassenaar

I didn't see any question in your post. But if you want to use an aggregation function like count in a load statement you will have to add the other fields you load to a group by statement:


Load [Recovery Plan Name],
[RTC Score] as RTCS,
Count(DISTINCT(IF([RTC Score]='RED',[Recovery Plan Name])))
Resident QLIK

GROUP BY [Recovery Plan Name], [RTC Score] ;


talk is cheap, supply exceeds demand
Anonymous
Not applicable

Hi,

Try:

In Script:

RTC:
Load [Recovery Plan Name],
[RTC Score],
Count(DISTINCT(IF([RTC Score]='RED',1,0))) as RTCS2
Resident QLIK
Group By [Recovery Plan Name],[RTC Score];

Regards

Neetha

eigorman
Partner - Contributor II
Partner - Contributor II
Author

So the Recovery Plan Name has multiple entries. And RTC Score can be either Green or Red.  I want to get distinct on the count of plans, where one of the RTC Score equals Red.

Ed