使用OR和IIF [英] Using OR and IIF
问题描述
我正在考虑计算我所在部门的客户满意度,我需要知道在一次评估中,员工收到的所有问题中有多少5(总是超过)。并且有20个请求。
这是我在querry写的代码,但是计数不对,它给了我总共6个,但是总数假设为20,因为我有5个5in performance_1,5在performance_3中,performance_2中的5个,5个中的5个,以及performance_4中的5个中的5个。
计数5:
Hi, I am doing a querry to calculate the customer satisfacation in my division and I need to know how many 5(always exceed) the employee received in one evaluation from a customer for all the questions. And there are 20 quetsions.
Here is my code that I wrote in the querry, but the count is not right, it gave me the total of 6, but the total suppose to be 20 because I have 5 of 5in performance_1, 5 of 5 in performance_2, 5 of 5 in performance_3, and 5 of 5 in performance_4.
Count 5:
推荐答案
我正在考虑计算我所在部门的客户满意度,我需要知道在一次评估中,员工收到的所有问题中有多少5(总是超过)。并且有20个请求。
这是我在querry写的代码,但是计数不对,它给了我总共6个,但是总数假设为20,因为我有5个5in performance_1,5在performance_3中,performance_2中的5个,5个中的5个,以及performance_4中的5个中的5个。
计数5:计数(IIf([performance_1] = 5或[Performance_2] = 5或[Performance_3] = 5或[Performance_4] = 5或[Performance_5] = 5或[ Performance_6] = 5或[Performance_7] = 5或[Performance_8] = 5或[Performance_9] = 5或[Performance_10] = 5或[Performance_11] = 5或[Performance_12]或[Performance_13] = 5或[Performance_14] = 5或[专业] = 5或[保密] = 5或[所有权] = 5或[问责制] = 5或[承诺] = 5或[通信] = 5或[电话] = 5或[管家] = 5或[安全] = 5或[关怀] = 5或[总体] = 5,是))
有人可以帮忙。非常感恩,祝你有个愉快的假期。
Elaine
Hi, I am doing a querry to calculate the customer satisfacation in my division and I need to know how many 5(always exceed) the employee received in one evaluation from a customer for all the questions. And there are 20 quetsions.
Here is my code that I wrote in the querry, but the count is not right, it gave me the total of 6, but the total suppose to be 20 because I have 5 of 5in performance_1, 5 of 5 in performance_2, 5 of 5 in performance_3, and 5 of 5 in performance_4.
Count 5: Count(IIf([performance_1]=5 Or [Performance_2]=5 Or [Performance_3]=5 Or [Performance_4]=5 Or [Performance_5]=5 Or [Performance_6]=5 Or [Performance_7]=5 Or [Performance_8]=5 Or [Performance_9]=5 Or [Performance_10]=5 Or [Performance_11]=5 Or [Performance_12] Or [Performance_13]=5 Or [Performance_14]=5 Or [Professionalism]=5 Or [Confidentiality]=5 Or [Ownership]=5 Or [Accountability]=5 Or [Commitment]=5 Or [Communication]=5 Or [Telephone]=5 Or [Stewardship]=5 Or [Safety]=5 Or [Caring]=5 Or [Overall]=5,"yes"))
can somebody help please. thanks a lot and have a nice day.
Elaine
Hi Elaine,
搭配就像你的表格并没有真正规范化,但我猜这个问题与Nulls有关。
当其中一个字段中有一个Null(无/无)值时,比较不行。
解决方案是使用NZ()函数,如:
计数5:计数(IIf(NZ([performance_1])= 5或新西兰([Performance_2])= 5或NZ([Performance_3])= 5 ....等..
得到这个想法?
Nic; o)
Hi Elaine,
Looks like your table isn''t really "normalized", but this problem I guess is Nulls related.
When there''s one of the fields holding a Null (nothing/unknown) value, the comparison won''t work.
The solution will be to use the NZ() function like:
Count 5: Count(IIf(NZ([performance_1])=5 Or NZ([Performance_2])=5 Or NZ([Performance_3])=5 .... etc..
Getting the idea ?
Nic;o)
除了Nico建议的内容之外,我认为你还期待与Count()函数不同的东西!
Count()只根据你的标准''计算'某个字段的出现。你听起来像是在尝试完成更多的Sum()函数。
问候,
Scott
In addition to what Nico suggests, I think you are also expecting something different from the Count() function than what it does!
Count() only ''counts'' the occurrences of a certain field according to your criteria. You sound like you''re trying to accomplish more of a Sum() function.
Regards,
Scott
Elai ne,
正如斯科特所说,我想我们可能需要对此进行一些重新思考。
你能为我们发布你的记录布局吗(表Meta-数据)并描述它是如何工作的(它意味着什么)。这样我们就可以建议一种更合适的方式来处理数据。
这是一个如何发布表元数据的例子:
表名= tblStudent
Elaine,
As Scott says, I think we may need a bit of a rethink here.
Can you post your record layout for us (Table Meta-Data) and describe how it works (what it means). That way we can suggest a more appropriate way to process the data.
Here is an example of how to post table MetaData :
Table Name=tblStudent
这篇关于使用OR和IIF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!