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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Oscar101
Contributor
Contributor

Count number of real operations ( Invoices minus credit notes)

Hello

This should be easy for an experienced user.

I need to count the number of real operation in a given area.

I know how to count the distinct values of transaction id's but those include credit notes ( when an invoice is cancelled).

So i need to count distinct transaction id's  minus distinct transaction id's ( that are credit notes).

i know it is something like Count this - count this or Count if.

But a bit at loss.

What funtions should i be investigating?

Thank you in advance!

Labels (4)
2 Replies
Chanty4u
MVP
MVP

Try this

Count(DISTINCT {<Type={'Operation'}>} TransactionID) - Count(DISTINCT {<Type={'Credit Note'}>} TransactionID)

 

Oscar101
Contributor
Contributor
Author

Hi  Thanks!

But not working

There is a total of 74 diferent unique document numbers. 7 of those are credit notes. So positive amount documents are 67. Real transactions are 67 - 7 ( credit notes cancel invoices).

So this formula counts distinct OperDocumentoNum = 74 and substract the distinct OperSerie = SED or ACC ( which are credit notes) so it gives me 67.

I need the credit notes to be substracted twice ( once for not adding them into the sum and another to get net transactions ( invoices - credit notes).

When i try the - count ( xxxx) again. It only substracts it once. 

I put the data at the end

(Count({<OperSerie={'PTN'}>} distinct OperDocumentoNum) + Count({<OperSerie={'SET'}>} distinct OperDocumentoNum) + Count({<OperSerie={'PDF'}>} distinct OperDocumentoNum) + Count({<OperSerie={'PTF'}>} distinct OperDocumentoNum) + Count({<OperSerie={'PWEB'}>} distinct OperDocumentoNum) + Count({<OperSerie={'WEB'}>} distinct OperDocumentoNum) - ((Count({distinct< OperSerie={'SED'}>} distinct OperDocumentoNum))) - ((Count({distinct< OperSerie={'SED'}>} distinct OperDocumentoNum)))- Count({<OperSerie={'ACC'}>} distinct OperDocumentoNum) - Count({<OperSerie={'ACM'}>} distinct OperDocumentoNum))


OperDocumentoNum      
DIA-ACC-23000028      
DIA-OCC-23000080      
DIA-OCC-23000081      
DIA-OCC-23000185      
DIA-OCC-23000186      
DIA-OCC-23000187      
DIA-OCC-23000188      
DIA-OCC-23000189      
DIA-OCC-23000291      
PTN-DIA-23000094      
PTN-DIA-23000095      
PTN-DIA-23000096      
PTN-DIA-23000097      
PTN-DIA-23000098      
PTN-DIA-23000099      
PTN-DIA-23000100      
PTN-DIA-23000101      
PTN-DIA-23000102      
PTN-DIA-23000379      
PTN-DIA-23000380      
PTN-DIA-23000382      
PTN-DIA-23000383      
PTN-DIA-23000384      
PTN-DIA-23000635      
PTN-DIA-23000636      
PTN-DIA-23000637      
PTN-DIA-23000638      
PTN-DIA-23000639      
PTN-DIA-23000640      
PTN-DIA-23000641      
SED-DIA-23000084      
SED-DIA-23000130      
SED-DIA-23000131      
SED-DIA-23000132      
SED-DIA-23000133      
SED-DIA-23000134      
SET-DIA-23000282      
SET-DIA-23000283      
SET-DIA-23000284      
SET-DIA-23000285      
SET-DIA-23000286      
SET-DIA-23000287      
SET-DIA-23000288      
SET-DIA-23000289      
SET-DIA-23000290      
SET-DIA-23000586      
SET-DIA-23000587      
SET-DIA-23000588      
SET-DIA-23000589      
SET-DIA-23000590      
SET-DIA-23000591      
SET-DIA-23000592      
SET-DIA-23000593      
SET-DIA-23000594      
SET-DIA-23000874      
SET-DIA-23000875      
SET-DIA-23000876      
SET-DIA-23000877      
SET-DIA-23000878      
SET-DIA-23000879      
SET-DIA-23000880      
SET-DIA-23000881      
SET-DIA-23000882      
SET-DIA-23000883      
SET-DIA-23000884      
SET-DIA-23000885      
SET-DIA-23000886      
SET-DIA-23001352      
SET-DIA-23001353      
SET-DIA-23001354      
SET-DIA-23001355      
SET-DIA-23001356      
SET-DIA-23001357      
SET-DIA-23001358      
       
Total Distinct Docuemnts Credit notes Documents not credits Real Operations
74 7 67 60