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

Announcements
Independent validation for trusted, AI-ready data integration. See why IDC named Qlik a Leader: Read the Excerpt!
cancel
Showing results for 
Search instead for 
Did you mean: 
Eshwar
Partner - Contributor
Partner - Contributor

Rangesum/Rangeavg running getting an error

I have two tables 'HC' and 'Exit' creating an attrition table .

Apr - (sum(Exit)/avg(HC))*9/1 
May- (sum(Exit)/avg(HC))*9/2 and so on... 

Have filter called primary reason which contains 'Val' and 'Inval' - in 'Exit' table but not in 'HC'.

fx:=

(RangeSum(Above(Count({<Table_from={'Exit'}>}[Employee ID]),0,RowNo()))
/
RangeAvg(Above(Count({<Table_from={'HC'},[Primary Termination Reason]=>}[Employee ID]),0,RowNo())))
*
(9/RowNo()))

 

But getting blank value if exit count is Zero.  Please help me on fixing the value.

 

Labels (1)
1 Reply
Sayed_Mannan
Creator II
Creator II

You can use the IF statement to check for zero values and handle them appropriately.

try this:

IF(
RangeSum(Above(Count({<Table_from={'Exit'}>}[Employee ID]), 0, RowNo())) = 0,
0,
(RangeSum(Above(Count({<Table_from={'Exit'}>}[Employee ID]), 0, RowNo())) /
RangeAvg(Above(Count({<Table_from={'HC'}, [Primary Termination Reason]=>}[Employee ID]), 0, RowNo()))) *
(9 / RowNo())
)