Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
RK121
Contributor III
Contributor III

Need to Exclude Null Values from Calculation on Future dates

Hello! I am new to Qlikview/Qliksense. I am using the Linier regression to calculate the trend/forecast.

My current syntax aims to predict sum of the TN_QTY based on last year data. In SQL query I have generated 6 month of future data that has null values of TN_QTY.I don't use linier trendlines at chart properties, because I need to build a table with data. It seems to be calculating incorrectly. Because the trend also calculating the #NULL values from for my future month. 

What is the best way to avoid this, and correct my trend line? How can I exclude future zeros in Set Analysis? Thank you in advance! 

Expression for Trend: 

linest_M(total aggr(SUM([TN_QTY_F]),UPDATE_DT_F),UPDATE_DT_F)*UPDATE_DT_F + linest_b(total aggr(SUM([TN_QTY_F]),UPDATE_DT_F),UPDATE_DT_F)

 

RK121_0-1661784824525.png

QlikView  , Qlik Sense Business 

Labels (1)
1 Solution

Accepted Solutions
BrunPierre
Partner - Master
Partner - Master

Replace SUM([TN_QTY_F]) with

SUM({$<TN_QTY_F={">0"}>} TN_QTY_F)

or

SUM({$<TN_QTY_F={"=Len(TN_QTY_F)=0"}>} TN_QTY_F)

 

 

 

View solution in original post

2 Replies
BrunPierre
Partner - Master
Partner - Master

Replace SUM([TN_QTY_F]) with

SUM({$<TN_QTY_F={">0"}>} TN_QTY_F)

or

SUM({$<TN_QTY_F={"=Len(TN_QTY_F)=0"}>} TN_QTY_F)

 

 

 

RK121
Contributor III
Contributor III
Author

@BrunPierre Thank you, works!