Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

MKT (Mean Kinetic Temperature) in Qlikview

Has anyone tried to calculate MKT (Mean Kinetic Temperature) in Qlikview. I'm looking for a way to do the calculations in Qlikview but haven't had any luck.

3 Replies
swuehl
MVP
MVP

What is your current expression?

Not applicable
Author

I am currently using an excel function and then bringing in the data. However there is currently over 230,000 temperature data points and more added daily.

This is the macro I use in excel:

Function MKT(ByVal Temperatures As Variant) As Double

Dim Sum As Double

Dim TemperatureCount As Long

Dim GasConst As Double

Dim DeltaH As Double

Dim Conv As Double

Conv = 273.15

GasConst = 8.314472

DeltaH = 10 * GasConst

Sum = 0

For TemperatureCount = Temperatures.Cells.Count To 1 Step -1

Sum = Sum + Exp(-DeltaH / (GasConst * (Temperatures(TemperatureCount) + Conv)))

Next TemperatureCount

MKT = (DeltaH / GasConst) / (-Log(Sum / Temperatures.Cells.Count)) - Conv

End Function

How can I create this in Qlikview? I tried creating variables and calculating the variables but it doesn't work.

swuehl
MVP
MVP

Ok, your time intervals are equal then.

Instead of the for loop, the QV way of doing this is to create a field in your data model that holds the temperature values T, then use QV aggregation functions (namely sum()) to automatically iterate over all values.

See attached for a sample.