Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Sxbbb
Creator III
Creator III

All values ​​in each WorkOrder must be between Min and Max for the Count of WorkOrder to be counted in the 'With in min-max work lot' table.

I have field

WorkOrder ,

Value,

Max,

Min,

Line

 

I want to create a table like this

Sxbbb_1-1677744138433.png

 

Example 1 WorkOrder 

Sxbbb_0-1677743131543.png

If the value is between 27-35, count the WorkOrder in the 'With in min-max work lot' table. and if the value is not between Max and Min, count the WorkOrder in the 'out of min-max work lot' table.

*All values ​​in each WorkOrder must be between Min and Max for the Count of WorkOrder to be counted in the 'With in min-max work lot' table.*

 

3 Replies
edwin
Master II
Master II

you should add a flag during load of data that specifies if the row meets your range criteria then just add that in your set analysis.  it is curious though that for a single WO you have multiple rows.  therefore it is possible that that work order would have a row that is within range and another row outside of the range - how do you address that scenario?

something like this:

 

load .... //your other fields here
if(Value>=min and Vale<=max,1,0) as RangeFlag
....

 

then in your set analysis would have something like this:

 

=count(distinct {<RangeFlag={1}>} WorkOrder)  // for workorders within range
=count(distinct {<RangeFlag={0}>} Workorder) //for work orders outside of the range

 

edwin
Master II
Master II

to take this one step further, if your business rule for multiple statuses for a single work order is "count the work order in rangle only if there are no situations where the work order is out of range"

load *, if(Value>=Min and Value<=Max,1,0) as Flag inline [
Line, WO, Value, Max, Min
1,W01,100,99,50
1,W01,60,99,50
1, W02, 200,99,50
1, W03, 55,99,50
];

 

work order 1 has rows for both outside and within range.  if we obey the rule above this shoudl be counted as out of range.

edwin_0-1677856002677.png

the e function will help in that regards.  so it will really depend on your business rule.

edwin
Master II
Master II

just noticed this is a duplicate post which confirms the business rule is all rows must be within range.  didnt notice it written in this post as well, anyways the solution above should work but you obviously need to tweak it to conform to your code.