Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Aggr and Set analysis

Hi there qlikview community,

I have used aggr and set analysis to product my expression which is:

Aggr(Count({<SensorValue={"= SensorValue>= HighControlLimit"} + {"= SensorValue<= LowControlLimit"}>}SensorValue),ValidatorUnit,Sensor,SensorParam)

The problem is that my expression does not behave as intented.As you can see in the attached pictures below it works perfectly when i select onle one sensor

but it gives me some null values when i sellect all of them.

Any idea why this is happening???

1 Solution

Accepted Solutions
jonathandienst
Partner - Champion III
Partner - Champion III

Hi

Are HighControlLimit and LowControlLimit field names?

If they are, then your expression is comparing SensorValue with the entire list of values, which does not work as you see. When you make a selection, then SensorValue is being compared with specific values for the limits and that works.

If I am correct, then I assume that you are trying to compare SensorValue with limit values in the same record. You cannot do this with set analysis. You must either use a Sum(If()) expression, or set a flag value in the load script and use the flag in your set expression.

Hope that helps

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein

View solution in original post

4 Replies
Gysbert_Wassenaar

Try:

Aggr(Count({<SensorValue={">=$(HighControlLimit)<=$(LowControlLimit)"}>} SensorValue),ValidatorUnit,Sensor,SensorParam)


talk is cheap, supply exceeds demand
Not applicable
Author

Unfortunately that did not solve ethe proble ..Insted i got as a result everything null...

I can not think a reason that this expression works for one sellection and not for many.

jonathandienst
Partner - Champion III
Partner - Champion III

Hi

Are HighControlLimit and LowControlLimit field names?

If they are, then your expression is comparing SensorValue with the entire list of values, which does not work as you see. When you make a selection, then SensorValue is being compared with specific values for the limits and that works.

If I am correct, then I assume that you are trying to compare SensorValue with limit values in the same record. You cannot do this with set analysis. You must either use a Sum(If()) expression, or set a flag value in the load script and use the flag in your set expression.

Hope that helps

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
Not applicable
Author

Yes you are right Jonathan HighControlLimit and LowControlLimit are field names...Aha that is why..Happy to

managed to sort out the logic on that.