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: 
abhaysingh
Specialist II
Specialist II

scenario logic help

Hi All,

i have one scenario in which Sensor are sending temperature every minutes.

and there is possibility for them that sensor become faulty and will not sending any data .

so let say i have 50 sensor i want to pick there last temperature record so i am using

firstsortedvalue(SensorStatus,-Timestamp)

so i am using it in straight table and its working perfenctly..

now i want the count of Faulty assets should be displayed in Text Box..

let say sensor is out of range than i need to count of sensor which are out of range in text box.

How i can do that?

pls suggest..

1 Solution

Accepted Solutions
sunny_talwar

May be this:

Sum(Aggr(If(FirstSortedValue(SensorStatus,-Timestamp) = 'Faulty', 1, 0), Sensor))

View solution in original post

4 Replies
sunny_talwar

May be this:

Sum(Aggr(If(FirstSortedValue(SensorStatus,-Timestamp) = 'Faulty', 1, 0), Sensor))

jonathandienst
Partner - Champion III
Partner - Champion III

>>let say sensor is out of range than i need to count of sensor which are out of range in text box.

By out of range, so you mean that the last update was older than a threshold value? Then somethng like:

=Count(Aggr(If(Max(Timestamp) <= (Now() - (vThreshold / 1400)), SensorID), SensorID))

(where vThreshold is a timeout period in minutes, SensorID is a unique sensor ID)

This expression will count the sensors whose last update was more than vThreshold minutes ago.

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
abhaysingh
Specialist II
Specialist II
Author

HI Sunny,

in above scenario there is one more case

Sum(Aggr(If(FirstSortedValue(SensorStatus,-Timestamp) = 'Faulty', 1, 0), Sensor))

i want the count for Faulty and Faulty1, Do i need to add it or i can do in one exp?

sunny_talwar

Try this:

Sum(Aggr(If(Match(FirstSortedValue(SensorStatus,-Timestamp), 'Faulty', 'Faulty1'), 1, 0), Sensor))