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

Sum Totals with two different conditions

Hello all,

I'm trying to get a total in a denominator for reaching a 100% .

The thing is that  I have two conditions parts in the expression so I need to have a total expression taking into account these conditions.

I have attached an example, the first expression is Okey, for the numerator but, for the denominator, I need to aggregate by totals and taking into account the condtions.

Any advice?

Thanks in advance

1 Solution

Accepted Solutions
its_anandrjs

Find the attached for Denominator use this expression

Count(TOTAL distinct{<TypeDate={'Atype'},State={'A'}>}idProduct) + Count(TOTAL distinct{<TypeDate={'Btype'},State ={'B','C','D'}>}idProduct )

OP1.PNG

View solution in original post

6 Replies
madhumitha
Creator
Creator

Hello Beatriz,

please try below expression as your denominator

Count(distinct{<TypeDate={'Atype'},State={'A'}>}idProduct) + Count(distinct{<TypeDate={'Btype'},State ={'B','C','D'}>}idProduct )

Thanks!

its_anandrjs

Find the attached for Denominator use this expression

Count(TOTAL distinct{<TypeDate={'Atype'},State={'A'}>}idProduct) + Count(TOTAL distinct{<TypeDate={'Btype'},State ={'B','C','D'}>}idProduct )

OP1.PNG

sunny_talwar

Here is another way to do this

Sum(TOTAL Aggr(If(State = 'A', Count(DISTINCT {<TypeDate={'Atype'}>}idProduct),

If(State = 'B' or State = 'C' or State = 'D', Count(DISTINCT {<TypeDate={'Btype'}>}idProduct))), State))


Capture.PNG

Anonymous
Not applicable
Author

Thanks  a lot Sunny, your solution worked and helped me as always.

Anonymous
Not applicable
Author

Thanks a lot ! It works!

Anonymous
Not applicable
Author

Thanks Madhu! I needed to add totals to that expression in order to work. Thanks for you help