Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I am trying to create a table in QlikView, using attributes from an SQL database.
The table in the database is composed of "Boolean" values, which are shown as either "0" or "1".
I want to load, for example, only those data which have a value of TRUE (meaning : "1")
Here is my load script :
Customers :
LOAD
personHasEmail,
(personHasEmail = '1') as Email_YES
(Meaning : ALL data, where the person has an email, will be taken from the database)
And, in QlikView, I have the following expressions :
Count (CustomerID)
Count(Email_YES)
(Each customer has a unique ID. So, "Count CustomerID" will produce the total number of people in the database)
And, "Count(Email_YES") should display ONLY those people who have email addresses.
But, this is not working;
Both expressions are displaying the TOTAL number of customers;
Obviously, the Count(Email_YES) expression is not working. Instead of counting only those people with emails, it's counting everyone.
Any help would be greatly appreciated.
Try this:
Customers :
LOAD
personHasEmail,
If(personHasEmail = '1', 1, 0) as Email_YES
then use
Count({$<Email_YES={'1'}>} CustomerID)
let me know
Thanks, Allesandro.
Unfortunately, the expression produced a zero ("0") value.
Hi Stepen,
see the attached example:
Script
Data:
Load * Inline
[
Customer, EmailFlag
A,1
B,1
C,1
D,0
];
Expression in chart
Count(If(EmailFlag = 1, Customer))
HTH Andy
Could you share your doc (or a similar example) ?
Hi Andy,
thanks for your reply.
I assume, from your example, I should replace Customer with CustomerID ?
And, EmailFlag..........with "PersonHasEmail"?
I did that. And, I'm getting the same result : zero (0)
Sorry, which doc?
I'm new to this
You mean the results I am getting?
The qlikview file (.qvw)
HI Stephen,
the example was just to show the principle, upload your QVW please.
Andy
Hi,
I think you should just load everything as it is, and in your expression in UI, you can count where Email_Yes= 1.
As in
LOAD
personHasEmail,
personHasEmail as Email_YES
From Source;
Then in your expression to count Email_Yes
Count({<Email_Yes = {1}>} Email_Yes)
This is work and you can Count your customer ID as well.