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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
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

1 Solution

Accepted Solutions
maxgro
MVP
MVP

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

View solution in original post

2 Replies
maxgro
MVP
MVP

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
Author

Thnx Massimo,

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