Qlik Community

Qlik Sense App Development

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

Announcements
Save the Date: QlikWorld Online, June 24-25, 2020. Free global virtual event for data integration and data analytic gurus. Register Today
New Contributor

How to calculate Kurtosis for each date

Hi Qlik community,

I want to check if my data set is normal distributed using Qlik Sense. For this I searched for some common tests like Kolmogorov–Smirnov test or Shapiro–Wilk test. I don’t think they are available in Qlik Sense!? Please inform me if these or similar tests are available. That would be very helpful.

As an alternative I want to calculate the Kurtosis and Skew. I don’t manage to calculate the Kurtosis and Skew for each row individually. Using the code

Kurtosis(total {$<DateId={">=$(vValidFrom)<=DateId"}>} aggr(sum(Value),DateId))

I get this table:

 DateId

Sum(Value)

Kurtosis

 

 

-0.25385

20191201

100

-0.25385

20191202

90

-0.25385

20191203

105

-0.25385

20191204

110

-0.25385

20191205

95

-0.25385

20191206

100

-0.25385

20191207

100

-0.25385

20191208

95

-0.25385

20191209

85

-0.25385

20191210

105

-0.25385

20191211

110

-0.25385

20191212

105

-0.25385

 

Here the variable vValidFrom is the date after which I want to use the data set. The data set itself consists of values summed for each date. I tried several modification of this code, removing total for example.

The Kurtosis in the example above is calculated over the entire data set. I however want to have the Kurtosis calculated for each row using the Sum(Values)’s that exist upto that point in time. For example, on the date 20191207 the Kurtosis should be based on the Sum(Value)’s from 20191201 until 20191207. This table should look like:

 

  DateId

Sum(Value)

Kurtosis

 

 

-0,25385

20191201

100

 

20191202

90

 

20191203

105

 

20191204

110

0,342857

20191205

95

-1,2

20191206

100

-0,3

20191207

100

0,312

20191208

95

0,146492

20191209

85

0,016827

20191210

105

-0,1518

20191211

110

-0,40439

20191212

105

-0,25385

 

How can I obtain the second table in QlikSense? Thank you in advance for your help!

 

Labels (3)
1 Solution

Accepted Solutions
Highlighted
Valued Contributor II

Re: How to calculate Kurtosis for each date

You need to use the RangeKurtosis function together with the Above function

RangeKurtosis(Above( sum(Value), 0, RowNo()))

See attached

View solution in original post

4 Replies
Highlighted

Re: How to calculate Kurtosis for each date

I don't think this will work, But as per principle of algorithm you can try this way (JFH)

((Count(Value)*(Count(Value)+1)/((Count(Value)-1)*(Count(Value)-2)*(Count(Value)-3)))*
Sum(Aggr(((Min(Aggr(Avg(Value), DateId))-avg(Value))*4)/(Stdev(Value)*4), DateId)))-
(((Count(Value)-1)*2)/(Count(Value)-2)*(Count(Value)-3))

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
Highlighted
New Contributor

Re: How to calculate Kurtosis for each date

Thank you for your reply. Your suggestion did not solve the issue. In an example I get values of < -70. These are very low since the kurtosis of a normal distribution is between -3 and 3. Thanks for the effort though!

Other suggestions on how to test if a data set is normal distributed are very welcome.

Highlighted
Valued Contributor II

Re: How to calculate Kurtosis for each date

You need to use the RangeKurtosis function together with the Above function

RangeKurtosis(Above( sum(Value), 0, RowNo()))

See attached

View solution in original post

Highlighted
New Contributor

Re: How to calculate Kurtosis for each date

Thank you for your reply! I didn't try RangeKurtosis in combination with Above before. It solved my issue.