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: 
thanhphongle
Creator II
Creator II

not expression in if expression

This is my database

ProductStatus

Notebook

Broken

Notebook

Broken

Notebook

Broken

Notebook

Stolen
NotebookBorrowed
CellphoneBroken

Cellphone

Broken
CellphoneBroken
CellphoneSold
CellphoneIn used

I want QV to return in a Textbox

Broken Products = 6

Not Broken Products = 4

I used this as expression

if(Status='Broken', count(Product))

if(Status=<>'Broken', count(Product))

Unfortunetely it is not working. Is there a solution with if expression and set analysis?

1 Solution

Accepted Solutions
sunny_talwar

Try this:

1) Count({<Status = {'Broken'}>}Product)

2) Count({<Status -= {'Broken'}>}Product) or Count({<Status ={'*'} - {'Broken'}>}Product)

View solution in original post

12 Replies
sunny_talwar

Try this:

1) Count({<Status = {'Broken'}>}Product)

2) Count({<Status -= {'Broken'}>}Product) or Count({<Status ={'*'} - {'Broken'}>}Product)

trdandamudi
Master II
Master II

May be as below:

=Count( {<Status={'Broken'}>}Product)

=Count( {<Status - ={'Broken'}>}Product)

Digvijay_Singh

Try this -

='Broken Product = ' & Count({<Status={'Broken'}>}Product) & chr(13) &

'Not Broken Products = ' & Count({<Status-={'Broken'}>}Product)

mightyqlikers
Creator III
Creator III

PFA.

$@M.

sunny_talwar

Sample attached

Capture.PNG

thanhphongle
Creator II
Creator II
Author

Thank you for the solution. Is there a solution with an IF- Expression?

sunny_talwar

Like this:

1) Count(If(Status = 'Broken', Product))

2) Count(If(Status <> 'Broken', Product))

sunny_talwar

Updated sample. But I am curious to know why do you want to use if rather than set analysis here? Any specific reason here?

Digvijay_Singh

Set expression will give better performance as it works with reduced set of records