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

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Having clause in an expression

Hi guys,

I am trying to find distinct customers who have a value of spend more than zero within a range.

My fields are called CustNo and val and the state is called Range 1 (or Range 2).

Is this possible in an expression?

Thanks for your help as always

20 Replies
Anonymous
Not applicable
Author

Is it because I need to use the "sum" of the value?

ashfaq_haseeb
Champion III
Champion III

did you try this?

=Count({<CustNo={"=sum(val)>0"}>} distinct CustNo)


Regards

ASHFAQ

Anonymous
Not applicable
Author

Yeeeeeees!! ! That worked.  Thanks very much Ashfaq I knew i was going wrong somewhere...

ashfaq_haseeb
Champion III
Champion III

Welcome

Regards

ASHFAQ

Anonymous
Not applicable
Author

Just want to go one further.. Haha.  Is it possible to group by these customers as i am still seeing the customers within the last but they are not being counted (which is good!) but i would like to not see them in the table..

I know i am a perfectionist!

Capture.JPG.jpg

anbu1984
Master III
Master III

Change your value expression to

If(Column(1)<>0,Value_expression)

Column(1) returns value of first expression

ashfaq_haseeb
Champion III
Champion III

Hi,

Add calculated dimension if (sum(Val)>0,CustNo)

Regards

ASHFAQ

Anonymous
Not applicable
Author

Brilliant !! Thanks Anbu that's worked a treat..

Anonymous
Not applicable
Author

Hi guys,

i am trying to take this a step even further and compare years which i have created variables for.

This expression doesn't work though

=COUNT({<CalendarYear ={$(vyear1)}>}{<CustNo={"=sum(val)>0"}>} Distinct left(Customer,5))

If i change the year within the variable box the data stays the same!

anbu1984
Master III
Master III

=COUNT({<CalendarYear ={$(vyear1)},CustNo={"=sum(val)>0"}>} Distinct left(Customer,5))