Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

timpoismans
Valued Contributor

Pivot table total as measurement

Hello

In an application for a customer, we're calculating a score based on a number of factors that represents the overall driving behaviour.

Now we want to compare the employee's individual score vs the average score.

Currently, I'm using the following formula:

(

(Sum(total<Year,Month,Week>{<MessageType = {'Acceleration'}>}IndType)*(Max({<MessageType = {'Acceleration'}>}WeightFactor))/10)

+

(Sum(total<Year,Month,Week>{<MessageType = {'Deceleration'}>}IndType)*(Max({<MessageType = {'Deceleration'}>}WeightFactor))/10)

+

(Sum(total<Year,Month,Week>{<MessageType = {'Curve'}>}IndType)*(Max({<MessageType = {'Curve'}>}WeightFactor))/10)

+

(Sum(total<Year,Month,Week>IndSpeed)*(Max({<%MessageTypeKey = {200}>}WeightFactor))/10)

)

/4

/ ((Sum(total<Year,Month,Week>Distance)/1000)/50)

The problem is, it gives me the average for that week, listing the weekly average in general next to each employee, so they can see the number theirs is being compared with, except that for one employee, the average is off. See screenshot:

Total issue.PNG

Anyone an idea on how this is possible or what may be the cause?

Thanks in advance.

Kind regards,

Tim Poismans

Tags (1)
1 Solution

Accepted Solutions

Re: Pivot table total as measurement

May be this

(

(Sum(total<Year,Month,Week>{<MessageType = {'Acceleration'}>}IndType)*(Max(total<Year,Month,Week>{<MessageType = {'Acceleration'}>}WeightFactor))/10)

+

(Sum(total<Year,Month,Week>{<MessageType = {'Deceleration'}>}IndType)*(Max(total<Year,Month,Week>{<MessageType = {'Deceleration'}>}WeightFactor))/10)

+

(Sum(total<Year,Month,Week>{<MessageType = {'Curve'}>}IndType)*(Max(total<Year,Month,Week>{<MessageType = {'Curve'}>}WeightFactor))/10)

+

(Sum(total<Year,Month,Week>IndSpeed)*(Max(total<Year,Month,Week>{<%MessageTypeKey = {200}>}WeightFactor))/10)

)

/4

/ ((Sum(total<Year,Month,Week>Distance)/1000)/50)

4 Replies

Re: Pivot table total as measurement

May be this

(

(Sum(total<Year,Month,Week>{<MessageType = {'Acceleration'}>}IndType)*(Max(total<Year,Month,Week>{<MessageType = {'Acceleration'}>}WeightFactor))/10)

+

(Sum(total<Year,Month,Week>{<MessageType = {'Deceleration'}>}IndType)*(Max(total<Year,Month,Week>{<MessageType = {'Deceleration'}>}WeightFactor))/10)

+

(Sum(total<Year,Month,Week>{<MessageType = {'Curve'}>}IndType)*(Max(total<Year,Month,Week>{<MessageType = {'Curve'}>}WeightFactor))/10)

+

(Sum(total<Year,Month,Week>IndSpeed)*(Max(total<Year,Month,Week>{<%MessageTypeKey = {200}>}WeightFactor))/10)

)

/4

/ ((Sum(total<Year,Month,Week>Distance)/1000)/50)

timpoismans
Valued Contributor

Re: Pivot table total as measurement

Should've thought of that.

But I don't see how that makes the difference for just that one employee?

Re: Pivot table total as measurement

I am guessing that this employee might have a different Max WeightFactor compared to others.... you can check this by adding a new expression Max(WeightFactor) and see if that is true. Add different set analysis to check all of them if you wish to confirm

timpoismans
Valued Contributor

Re: Pivot table total as measurement

Just checked, he indeed does have one different weight factor for one of the factors.

Thank you very much again!

Community Browser