Skip to main content

App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
QlikWorld 2023, a live, in-person thrill ride. Save $300 before February 6: REGISTER NOW!
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
Specialist II
Specialist II

Perhaps this

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

sidhiq91
Specialist
Specialist

@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.