Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

Assign score based on count function

Hi guys,

Need your help on something. I created a metric which should assign a score to customer or a piece of equipment depending on the number of notifications are created for the piece of equipment (an equipment is assigned to a customer). The scoring should be as follows:

  • From 0 to 10 notifications, the equipment should be assigned a score '10'
  • From 10 to 20 notificaitons, the equipment should be assigned a score '9'
  • and so on...

As we know,we cannot do a count function in the script, so I have to execute this function in the 'front end' but then I cannot find a way to link the matching score to a number of notifications. I tried the following but this didn't quite work:

Score: =If(count(distinct(NotificationNr)) <= 10, 10, if( etc.))

The above function did not work because if there are more than 10 notifications the scoring is not assigned correctly anymore.

Does anyone have suggestions?

Thanks in advance

Tags (3)
1 Solution

Accepted Solutions
MVP
MVP

Re: Assign score based on count function

maybe I don't understant but the if should work

if(count(distinct notificationnr) <= 10, 10,

if(count(distinct notificationnr) <= 20, 9,

if(count(distinct notificationnr) <= 30, 8,

if(count(distinct notificationnr) <= 40, 7,

if(count(distinct notificationnr) <= 50, 6,

if(count(distinct notificationnr) <= 60, 5,

if(count(distinct notificationnr) <= 70, 4,

if(count(distinct notificationnr) <= 80, 3,

if(count(distinct notificationnr) <= 90, 2,

if(count(distinct notificationnr) <= 100, 1,

0

))))))))))

1.jpg

2 Replies
MVP
MVP

Re: Assign score based on count function

maybe I don't understant but the if should work

if(count(distinct notificationnr) <= 10, 10,

if(count(distinct notificationnr) <= 20, 9,

if(count(distinct notificationnr) <= 30, 8,

if(count(distinct notificationnr) <= 40, 7,

if(count(distinct notificationnr) <= 50, 6,

if(count(distinct notificationnr) <= 60, 5,

if(count(distinct notificationnr) <= 70, 4,

if(count(distinct notificationnr) <= 80, 3,

if(count(distinct notificationnr) <= 90, 2,

if(count(distinct notificationnr) <= 100, 1,

0

))))))))))

1.jpg

Not applicable

Re: Assign score based on count function

Thnx Massimo,

Is must have entered it wrong somehow because your solution is the right one. Thans again

Community Browser