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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Identify Pure/Mixed Expression

Need help please, sorry if I'm not following all protocols, it's my first post.


I'm trying to compare INVOICE# with SUB and determine in TYPE (new field), when an Invoice# contains more than one Sub; If the same code appears in Sub for that particular Invoice# (which may repeat), that makes it Pure, if varying codes under Sub for one Invoice#, then Mixed.


In EXCEL I use the following Formula:

=IF(COUNTIFS(A$2:A$13,A2,B$2:B$13,B2)=COUNTIF(A$2:A$13,A2),"Pure","Mixed")


The QlikView Developer II book shows the AGGR Function

     aggr(count(Distinct OrderID), Customer ID)

Should I be looking at a similar expression?

Invoice#SubType
23359691AGRPure
23359691AGRPure
23359691AGRPure
23359691AGRPure
23359692AGRMixed
23359692AGRMixed
23359692AGRMixed
23359692OIFMixed
23359693AGRPure
23359693AGRPure
23359693AGRPure
23359693AGRPure
3 Replies
sunny_talwar

Try this

=If(Count(TOTAL <Invoice#> Invoice#) = Count(TOTAL <Invoice#, Sub> Invoice#), 'Pure', 'Mixed')


Capture.PNG

Anonymous
Not applicable
Author

Hi Sunny, thank you so much for your reply. QlikView seems to have an issue with the formula:

=if(Count(TOTAL <[Invoice Number]> [Invoice Number]) = Count(TOTAL <[Invoice Number], [Sub Section]> [Invoice Number]), 'Pure', 'Mixed')

I'm sure it's the same formula, but it didn't work for me, I removed the brackets to make it just like what you sent, but still not working, all records show as "Pure", even when the repeated Invoice has different Subs in the data.

   

Invoice NumberSub SectionPure/Mix
48450188NSPPure
48450189OIFPure
48450190AEDPure
48450190NSPPure
48450190NSPPure
48450190NSPPure
48450196AGRPure
48450197AEDPure
48450198NSPPure
48450199AEDPure
48450200AEDPure
48450202AGRPure
48450202AGRPure
48450203AEDPure
48450203AGRPure
48450204AASPure
48450204STAPure

Pure-Mix Formula.png.jpg

Anything I might be doing wrong?

Thanks again for your help. 

sunny_talwar

Would you be able to share the app to check out what might be going wrong?