Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
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
Partner - Master

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.