Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Touix
Contributor III
Contributor III

Sum of total number of family per account and see all the families

Hello everyone,

 

Since 2 days I try to figure out my problem but i can not :(!

 

I have this data :

Date- Account -  family - amount

01/01/2021 - 001 - 1 - 100

01/01/2021 - 001 - 1 - 200

01/01/2021 - 001 - 3 - 200

01/02/2021 - 002 - 4 - 500

01/02/2021 - 002 - 5- 500

 

I want this result : 

 Account - Family - Number of family - Total amount of the family

 001 - 1-  2 -  500

 001 - 3-  2 -  500

 002 - 4-  2 -  1000

 002 - 5-  2 -  1000

I try with sum(aggr(   COUNT(  distinct family ),account)) but with no success.

If someone can help me , thank you so much.

I put account and family with dimension.

1 Solution

Accepted Solutions
stevejoyce
Specialist II
Specialist II

With Account & Family as your table dimensions and expressions are:

Count(Distinct Total <Account> family)

and

Sum(Total <Account amount)

View solution in original post

5 Replies
stevejoyce
Specialist II
Specialist II

you can do this with sum Total.

Total amount of the family:

Sum(Total <Account amount)

and

Count(Total <Account> family)

Touix
Contributor III
Contributor III
Author

Thank you for your reply Steve.

But What I want is the count of disctinct family actually. Sorry for my bad example : 

I have this data :

Date- Account -  family - amount

01/01/2021 - 001 - 1 - 100

01/01/2021 - 001 - 1 - 200

01/01/2021 - 001 - 3 - 200

01/02/2021 - 002 - 4 - 500

01/02/2021 - 002 - 5- 500

 

I want this result : 

 Account - Family - Number of family - Total amount of the family

 001 - 1-  2 -  500

 001 - 3-  2 -  500

 002 - 4-  2 -  1000

 002 - 5-  2 -  1000

stevejoyce
Specialist II
Specialist II

With Account & Family as your table dimensions and expressions are:

Count(Distinct Total <Account> family)

and

Sum(Total <Account amount)

Touix
Contributor III
Contributor III
Author

Thank you very much Stevejoyce. it works well. It is something i have never seen. Thank you very much.

 

i have another question. Is it possible to put the family not in another line but with carriage return or a coma.

Exemple : 

           

 001 -    1,3    -  2 -  500

stevejoyce
Specialist II
Specialist II

You can use concat for this:

comma...

Concat(Distinct family, ',')

or carriage return...

Concat(Distinct family, chr(13))