Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
tinapullen1
Contributor
Contributor

Countifs based on another field

Hi, could someone please help me with a countifs query that I have:  I'm trying to show total number if the Trip # and the Customer # are the same e.g. Customer 1 had 3 orders on trip 1 so the result number I would be looking for is 3.  Customer 2 had 2 orders on trip 1 so the result would be 2. 

 

Customer #Trip #Result
Customer 113
Customer 113
Customer 113
Customer 212
Customer 212
Customer 321
Customer 421

 

Labels (1)
1 Solution

Accepted Solutions
sunny_talwar

Left Join the Count like this may be

Left Join (TableName)
LOAD [Customer #],
     [Trip #],
     Count([Trip #]) as Result
From TableName
Group By [Customer #], [Trip #];

 

View solution in original post

4 Replies
sunny_talwar

Add Customer # and Trip # as dimension and use Count([Trip #]) as your expression

tinapullen1
Contributor
Contributor
Author

Thank you for coming back to me Sunny - I should have been more clear.  I'm looking to do it in the script?

sunny_talwar

Left Join the Count like this may be

Left Join (TableName)
LOAD [Customer #],
     [Trip #],
     Count([Trip #]) as Result
From TableName
Group By [Customer #], [Trip #];

 

Brett_Bleess
Former Employee
Former Employee

Hey Tina, did Sunny's last post get you what you needed for your use case?  If so, do not forget to come back to the post and use the Accept as Solution button on Sunny's post to give him credit and let others know the guidance helped you get things working.  If you are still working on things, leave an update on where things stand.

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.