Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
robmarr789
Contributor
Contributor

count and sum with distinct

I am trying to write two expressions that will output the following based on the date below.

I've detailed the expected output based on the two conditions

 

Product codeFinal costL12 £     
98/120.02200     
98/120.02200     
98/13200569     
98/14300789     
98/15void cost600     
        
        
       Output
 Count No. of unique product codes where final cost <> "void cost"Result3
 Sum of L12 £ for unique product codes with where final cost <> "void cost"1558
Labels (2)
1 Solution

Accepted Solutions
sunny_talwar

May be this

Count(DISTINCT {<[Final cost] -= {'void cost'}>} [Product code])

or

Count(DISTINCT {<[Product code] = e({<[Final cost] -= {'void cost'}>})>} [Product code])

 

and for the other expression

Sum(Aggr(Sum(DISTINCT {<[Final cost] -= {'void cost'}>} [L12 £]), [Product code])

or

Sum(Aggr(Sum(DISTINCT {<[Product code] = e({<[Final cost] -= {'void cost'}>})>} [L12 £]), [Product code])

View solution in original post

2 Replies
sunny_talwar

May be this

Count(DISTINCT {<[Final cost] -= {'void cost'}>} [Product code])

or

Count(DISTINCT {<[Product code] = e({<[Final cost] -= {'void cost'}>})>} [Product code])

 

and for the other expression

Sum(Aggr(Sum(DISTINCT {<[Final cost] -= {'void cost'}>} [L12 £]), [Product code])

or

Sum(Aggr(Sum(DISTINCT {<[Product code] = e({<[Final cost] -= {'void cost'}>})>} [L12 £]), [Product code])
Brett_Bleess
Former Employee
Former Employee

Rob, did Sunny's post do the trick for you?  If so, do not forget to come back and use the Accept as Solution button on his post to mark it as correct and give him credit for the help with things.  If you did something different, consider posting that and mark it, and if you are still working on things, leave an update for us.

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.