Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
kevbrown
Creator II
Creator II

Calculation

Why does my expression not work -

=Count(if([Limit Code]='S1' and [E-Coli]='PASS' or

Count(if([Limit Code]='S2 And [E-Coli]='PASS', '1'))))

Thanks

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Because your nesting a Count() aggregation function into another aggregation, which is in general not possible.

What do you wan to achieve?

Maybe this?

=Count(

if( ([Limit Code]='S1' and [E-Coli]='PASS')  or ( [Limit Code]='S2 And [E-Coli]='PASS'), '1')

)

View solution in original post

11 Replies
tamilarasu
Champion
Champion

May be try.

Count({<[Limit Code]={'S1', 'S2'},[E-Coli]={'PASS'}>}[Limit Code])

If this is not what you need, please explain your requirement.

Kushal_Chawda

i think

Count( if( match([Limit Code],'S1' ,'S2') or [E-Coli]='PASS',1))

ankit777
Specialist
Specialist

Hi

Try this

Count(

if(

([Limit Code]='S1' and [E-Coli]='PASS') or

([Limit Code]='S2 And [E-Coli]='PASS'),

'1')

)

swuehl
MVP
MVP

Because your nesting a Count() aggregation function into another aggregation, which is in general not possible.

What do you wan to achieve?

Maybe this?

=Count(

if( ([Limit Code]='S1' and [E-Coli]='PASS')  or ( [Limit Code]='S2 And [E-Coli]='PASS'), '1')

)

kevbrown
Creator II
Creator II
Author

Thanks, easy as that hey!!

kevbrown
Creator II
Creator II
Author

Moving on from that and creating a % I've got this -

=(Sum(if(([Limit Code]='S1' and [Listeria]='PASS') or

([Limit Code]='S2' and [Listeria]='PASS') or

([Limit Code]='D3' and [Listeria]='PASS') or

([Limit Code]='D4' and [Listeria]='PASS') or

([Limit Code]='Group 2' and [Listeria]='PASS') or

([Limit Code]='Group 3' and [Listeria]='PASS')

,'1'))

/

Sum(if(([Limit Code]='S1' and [Listeria]='FAIL') or

([Limit Code]='S2' and [Listeria]='FAIL') or

([Limit Code]='D3' and [Listeria]='FAIL') or

([Limit Code]='D4' and [Listeria]='FAIL') or

([Limit Code]='Group 2' and [Listeria]='FAIL') or

([Limit Code]='Group 3' and [Listeria]='FAIL') or

([Limit Code]='S1' and [Listeria]='PASS') or

([Limit Code]='S2' and [Listeria]='PASS') or

([Limit Code]='D3' and [Listeria]='PASS') or

([Limit Code]='D4' and [Listeria]='PASS') or

([Limit Code]='Group 2' and [Listeria]='PASS') or

([Limit Code]='Group 3' and [Listeria]='PASS')

,'1')))

but it doesn't work!

swuehl
MVP
MVP

Doesn't work means no result or wrong result?

I think the very last closing bracket needs to be removed.

Do both aggregations return something on their own?


kevbrown
Creator II
Creator II
Author

It just displays '1' on the graph

Yes they work as stand alone calculations

swuehl
MVP
MVP

They work standalone and returning different numbers per dimensional line?

Have you maybe set the number format to only show integers?