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

Announcements
Posting on Qlik Community is temporarily paused. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
Sheetal
Contributor II
Contributor II

Distinct clause in qliksense

Hello all

I have a table which has the following fields

Assistance ID Hours YearMonth
1439984 2 2018Jan
1439984 2 2018Jan
1439984 2 2018Jan
1439986 3 2018Mar
1439986 3 2018Mar

This is already grouped by Assistance id. I have a qlik straight table with YearMonth as a dimension and Sum(Hours) as one of the mesaures.I want to count the hours only once if the assistance id is multiple times .I suppose I could use the distinct clause but not sure how to link it to the assistance id. For example for the month of Jan2018, the sum(hours) = 2 and not 6.
Is there a way to do this using an expression. Thanks in advance.

Sheetal

Labels (1)
2 Solutions

Accepted Solutions
Claudiu_Anghelescu
Specialist
Specialist

=Sum(Aggr(Only(Hours),[Assistance ID], YearMonth, Hours))

To help community find solutions, please don't forget to mark as correct.

View solution in original post

Akshesh_Patel
Support
Support

hi,

=Sum(distinct(Hours))

- See the attached image

- Please mark the thread as a solution, if any solution from this post has been worked for you. 

 

Thank you

Akki

View solution in original post

3 Replies
Claudiu_Anghelescu
Specialist
Specialist

=Sum(Aggr(Only(Hours),[Assistance ID], YearMonth, Hours))

To help community find solutions, please don't forget to mark as correct.
Akshesh_Patel
Support
Support

hi,

=Sum(distinct(Hours))

- See the attached image

- Please mark the thread as a solution, if any solution from this post has been worked for you. 

 

Thank you

Akki

Sheetal
Contributor II
Contributor II
Author

Thank you.