Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Ayoub
Contributor III
Contributor III

Count only one time by Dimension

Hello community 

I need ur help or guideness in this problems:  

i'm measuring the quality of data like the example below, in a sequentially way : Wrong -> Doubtful -> inconsistency

Code TypeOfError
21580963 Wrong
21580963 doubtful
23084975 inconsistency
22597436 Wrong
26700453 Wrong
26700453 doubtful

I wanna do a count on the code in a way that :

If Data is wrong, it shouldn't be count in doubtful and in inconsitency

i should havy the end something like this : 

Code Wrong doubtful inconsistency
21580963 1 0 0
23084975 0 0 1
22597436 1 0 0
26700453 1 0 0

 

I tried some calculate expression on script but i didn't get the result i wanted : 

Count(DISTINCT if(Match(TypeOfError,'Wrong') and not Match(TypeOfError,'doubtful') and not Match(TypeOfError,'inconsistency'),CODECLIENT)) as Wrong,
Count(DISTINCT if(Match(TypeOfError,'doubtful') and not match(TypeOfError,'Wrong') and not Match(TypeOfError,'inconsistency'),CODECLIENT)) as doubtful,
Count(DISTINCT if(Match(TypeOfError,'inconsistency') and not Match(TypeOfError,'doubtful') and not match(TypeOfError,'Wrong'),CODECLIENT)) as inconsistency,

Thank u

Labels (2)
1 Reply
BrunPierre
Partner - Master
Partner - Master

Possibly these at the frontend

Count({$<TypeOfError=E({1<TypeOfError={'Doubtful','Inconsistency'}>})>}DISTINCT Code)  //Wrong

Count({$<TypeOfError=E({1<TypeOfError={'Wrong','Inconsistency'}>})>}DISTINCT Code)     //Doubtful

Count({$<TypeOfError=E({1<TypeOfError={'Wrong','Doubtful'}>})>}DISTINCT Code)             //Inconsistency