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: 
Manuel174102
Creator
Creator

How to set to 0 negative values in a formula

Hello everyone,

I have a kpi that is showing the average lead time. 

The formula is the following: 

Avg({<[Posting Date]-={2015, 2016}>}[Processing Time] )

The thing is, some of this lead times ( aka processing time) are negative, and I want them to be 0. How can I modify this formula to make that work?

 

thanks in advance

Labels (1)
2 Replies
BrunPierre
Partner - Master II
Partner - Master II

Perhaps this

Avg({<[Posting Date]-={2015, 2016},[Processing Time]={"> 0"}>}[Processing Time])

sidhiq91
Specialist II
Specialist II

@Manuel174102 You can add the below line in the Script Editor first and then you can continue to use your expression above.

if([Processing Time]<0,0,[Processing Time]) as [Processing Time].

This should resolve the issue.