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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
luohda
Contributor III
Contributor III

Count when the calculation between 2 fields are higher than 1.5 and lower than 0.5

Fields:

company, probe, measure (in different parameters, here only 'm-dichlor' and 'p-dichlor' are considered)

Relations:

each company has several probes, each probe has measurements in different parameters.

Goal: 

I want to calculate the numbers of probes in each company, whose p-dichlor measure / m-dichlor measure > 1.5 or <0.5

 

my divition of this p and m-dichlor measures is:

div(only({<[PARAMETER]={'p-Dichlorbenzol'}>} [MEASURE])*100, only({<[PARAMETER]={'m-Dichlorbenzol'}>} [MEASURE]))/100

Then when counting how many probes in each company are out of measure range for example smaller than 0.5, it doen't work:

count({<[PROBE_ID]={"=$(div(only({<[PARAMETER]={'p-Dichlorbenzol'}>} [MEASURE])*100, only({<[PARAMETER]={'m-Dichlorbenzol'}>} [MEASURE]))<50)"}>}  [COMPANY_ID])

(I times the first field with 100 cause div() gives only integer value, the when the value is smaller than 0.5 it's smaller than 50 cause i times 100 before)

example: on the left is probe_id, the first row is 120/2=60, p/m bigger than 1.5 or smaller than 0.5 is what i want to count.

Capture.PNG

thanks!!!

Labels (2)
1 Solution

Accepted Solutions
gmenoutis
Partner - Creator II
Partner - Creator II

The first thing one notices quickly is the use of the evaluation operator $() without a string passed to it. Could it be because you are confused on using search masks in set analysis? Try removing the evaluation operator:

 

count({<[PROBE_ID]={"=

// Removed $(

div(only({<[PARAMETER]={'p-Dichlorbenzol'}>} [MEASURE])*100,only({<[PARAMETER]={'m-Dichlorbenzol'}>} [MEASURE]))<50

// Removed)

"}>}  [COMPANY_ID])

View solution in original post

2 Replies
gmenoutis
Partner - Creator II
Partner - Creator II

The first thing one notices quickly is the use of the evaluation operator $() without a string passed to it. Could it be because you are confused on using search masks in set analysis? Try removing the evaluation operator:

 

count({<[PROBE_ID]={"=

// Removed $(

div(only({<[PARAMETER]={'p-Dichlorbenzol'}>} [MEASURE])*100,only({<[PARAMETER]={'m-Dichlorbenzol'}>} [MEASURE]))<50

// Removed)

"}>}  [COMPANY_ID])

luohda
Contributor III
Contributor III
Author

wow it works, i thought it doesn't work this way, thank you so much!
i'm relative new to qlik, what's the different between with $() and not? In which situation should I use it and when not? Cause I found many answers with this.