Qlik Community

Ask a Question

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
March 11, 2PM EST: Do More with Qlik - Getting Started wtih Qlik Sense SaaS - Redux. REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
shirleyc40
Creator
Creator

Distinct count of fieldA != fieldB

Hello!

I have data from a SQL DB that looks similar to this: 

idreported statusactual status
1successsuccess
1failsuccess
2undeterminedundetermined
3undeterminedsuccess
3-fail
3failfail

 

I'm trying to count the number rows that have reported status != actual status . I have this as my equation: 

Count ({<[reported status] -={"=[actual status]"}>} id). However, this is giving me a count that is too high, compared to when I check it in the SQL database. If I do unique id, I get a lower number but it isn't the right count either.

 

Labels (1)
5 Replies
Anil_Babu_Samineni

Perhaps this?

Count ({<id = {"=[reported status]<>[actual status]"}>} id)

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
GaryGiles
Creator III
Creator III

This probably is not the most efficient way to accomplish, but should return the correct results.

count(if(reported_status<>actual_status,id))

Chanty4u
Champion III
Champion III

try  below

sum(if(reported status <> actual statusAggr(Distinct(id),reported status ,actual status)) )

avinashelite

With the above sample data your excepting the output count to be 2 or  4

shirleyc40
Creator
Creator

why is a sum?