Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
barbarapoblocka
Contributor
Contributor

How to calculate no. of occurrences of logs if they were interrupted by some other logs

I'd like to calculate the number of how many times StatusLog number e.g 103 appeared for each ID, but only if it didn't appear in a couple of times in a row (so if it was interrupted by some other StatusLog number (please see attached image).

If the same status appeared muliple time in a row, it means there was no status change, but logs were added bc of some other events, that are not important for this calculations. For the attached example for the given ID, number of logs with the status 103 should equal 3.

 

Does anyone has an idea how to solve it?

 

 

1 Reply
kjhertz
Partner - Creator
Partner - Creator

Adding a field to the table in the script could be one way to acheive this:

Load
1+(StatusLog= previous(StatusLog)) as SumThis
...
From ..
Order by LogTime

Another possibility is to create an expression and then use expression total = Sum of rows, but beware this requires the chart to be sorted by LogTime:

=1+(only(OrderNo) = Above(total only(OrderNo)))

I would suggest you try both options in a chart and see how they behave when you apply selections in your application