Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
Could you please kindly assist me with the proper use of the "and" logical function in an expression. For example, I have tried using it as follows: Count(If(Year='2013'and [Estimate-Kg]>='0' and [Sales-Kg]<='1',[Grower No.],0)), this doesn't quite work. Is there also some sort of a "syntax" guide available?
Thank you
Herbiec 09
Your expression will return a number different from what you want. You use
Count(If(Year='2013'and [Estimate-Kg]>='0' and [Sales-Kg]<='1',[Grower No.],0))
You have four fields inside the aggregation, fields that probably reside in different tables. The logic is that QlikView first creates the join between these tables, and then performs the count on this temporary table. I.e. the number of rows will be much larger than you want.
Prabhu's expression will work - but only if "Year", "Estimate-Kg" and "Sales-Kg" exist as dimensions in the graph. Otherwise these will be evaluated to NULL. See more on http://community.qlik.com/blogs/qlikviewdesignblog/2013/08/06/it-s-all-aggregations
No, the proper way to do this, is to use Set Analysis:
Count({$<Year={'2013'}, [Estimate-Kg]={">=0"}, [Sales-Kg]={"<=1"}>} [Grower No.] )
HIC
Please rewrite the expression as,
If(Year='2013'and [Estimate-Kg]>='0' and [Sales-Kg]<='1',Count([Grower No.]),0)
Regards,
Prabhu
Your expression will return a number different from what you want. You use
Count(If(Year='2013'and [Estimate-Kg]>='0' and [Sales-Kg]<='1',[Grower No.],0))
You have four fields inside the aggregation, fields that probably reside in different tables. The logic is that QlikView first creates the join between these tables, and then performs the count on this temporary table. I.e. the number of rows will be much larger than you want.
Prabhu's expression will work - but only if "Year", "Estimate-Kg" and "Sales-Kg" exist as dimensions in the graph. Otherwise these will be evaluated to NULL. See more on http://community.qlik.com/blogs/qlikviewdesignblog/2013/08/06/it-s-all-aggregations
No, the proper way to do this, is to use Set Analysis:
Count({$<Year={'2013'}, [Estimate-Kg]={">=0"}, [Sales-Kg]={"<=1"}>} [Grower No.] )
HIC
Thanks Prabhu,
Unfortunately it's returning a zero count. I have manually checked the data, and I have instances where I have estimated kg's, but no actual sales, i.e. sales-kg = 0,
Any thoughts?
Herbiec09
As said by Henric .. Unless you have "Year", "Estimate-Kg" and "Sales-Kg as dimensions the above expression wont work.
It is better to use Set Analysis.
Spot On, many thanks Henric, this works perfectly. Really appreciate your help.
H
Many thanks Prabhu,
Yes u are right, that has finally worked. Appreciate you taking the time to look at it.
H