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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
abhaysingh
Specialist II
Specialist II

Logic Help..

Hi All,

I have one MinTemperature field and MaxTemperature Field. and one Current Temperature field..

I want to Calculate the Delta for this. e.g. Let Say Delta will be calculative on the basis of nearest Min or MaxTemp. in Below first case MinTemp is 1 and max is 5, but Current temp is 0.5 which is nearer to MinTemp so Delta is CurrentTemp - MinTemp.

MinTemp&''&MaxTempCurrentTempDelta
1 to 50.50.5
2 to 561
-1 to 5-1.20.2

Please suggest.

Thanks

Abhay

14 Replies
rubenmarin

Hi abhay, my first expression returns those values:

If(fabs(CurrentTemp-MinTemp)<fabs(CurrentTemp-MaxTemp), CurrentTemp-MinTemp, CurrentTemp-MaxTemp)

Digvijay_Singh

Yes, I agree.

abhaysingh
Specialist II
Specialist II
Author

hmm, but what would be the final expression? pls suggest

rubenmarin

If(fabs(CurrentTemp-MinTemp)<fabs(CurrentTemp-MaxTemp), CurrentTemp-MinTemp, CurrentTemp-MaxTemp)

Digvijay_Singh

As suggested by RubenMarin

exp.PNG