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

Show the Max Rows

Hi Experts,

Could you please help me with this QlikView requirement? Below is a sample dataset:

  • I need to show the first Timestamp, where the CPU > 90%.
  • It should also show the Duration in Seconds till when it remained above 90% .
  • When the CPU goes below 90, another Row will be displayed the next time CPU again goes above 90%.

Sample Dataset and Expected Outcome is provided below:

Sample Dataset:

Tab:
Load * Inline
[
Time , CPU
12:00:01, 70%
12:00:02, 92%
12:00:03, 93%
12:00:04, 91%
12:00:05, 54%
12:00:06, 86%
12:00:07, 97%
12:00:08, 95%
12:00:09, 67%
12:00:10, 99%
];

Expected Outcome:

TimeCPUDuration stayed above 90%
12:00:0292%3 secs
12:00:0797%2 secs
12:00:1099% 

 

Appreciate any help! 🙂 

Regards!

1 Solution

Accepted Solutions
Taoufiq_Zarra

@dmohanty  for load you can use for example :

Tab:


load *,if(peek(CPU)<0.9 and CPU>=0.9,1,0) as PickTmp
,if(peek(CPU)<0.9 and CPU>=0.9,1,if(peek(CPU)>=0.9 and CPU>=0.9,peek(Val)+1))  as Val,
if(rowno()=1,0,if(peek(CPU)<0.9 and CPU>=0.9,peek(ValGlobal),if(peek(CPU)>=0.9 and CPU>=0.9,peek(ValGlobal),peek(ValGlobal)+1)))  as ValGlobal;
Load Time , num(CPU) as CPU Inline
[
Time , CPU
12:00:01, 70%
12:00:02, 92%
12:00:03, 93%
12:00:04, 91%
12:00:05, 54%
12:00:06, 86%
12:00:07, 97%
12:00:08, 95%
12:00:09, 67%
12:00:10, 99%
];
left join load ValGlobal,Max(Val) as [Duration stayed above 90%] resident Tab group by ValGlobal;

output:

load Time ,CPU,if([Duration stayed above 90%]=1,'',[Duration stayed above 90%]&' secs') as [Duration stayed above 90%] resident Tab where PickTmp=1;

drop table Tab;

 

output:

Taoufiq_Zarra_0-1612777974666.png

 

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉

View solution in original post

6 Replies
Taoufiq_Zarra

@dmohanty  in load Script ?

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
dmohanty
Partner - Specialist
Partner - Specialist
Author

@Taoufiq_Zarra  - Either Load Script or Set Analysis (Chart Level)  is fine. 

Preferably at Chart level (with Set Analysis or Formula), as the data set is already loaded into model through Load Script.

dmohanty
Partner - Specialist
Partner - Specialist
Author

@Taoufiq_Zarra ,

 

Any possible suggestions? 

Regards!

Taoufiq_Zarra

@dmohanty  for load you can use for example :

Tab:


load *,if(peek(CPU)<0.9 and CPU>=0.9,1,0) as PickTmp
,if(peek(CPU)<0.9 and CPU>=0.9,1,if(peek(CPU)>=0.9 and CPU>=0.9,peek(Val)+1))  as Val,
if(rowno()=1,0,if(peek(CPU)<0.9 and CPU>=0.9,peek(ValGlobal),if(peek(CPU)>=0.9 and CPU>=0.9,peek(ValGlobal),peek(ValGlobal)+1)))  as ValGlobal;
Load Time , num(CPU) as CPU Inline
[
Time , CPU
12:00:01, 70%
12:00:02, 92%
12:00:03, 93%
12:00:04, 91%
12:00:05, 54%
12:00:06, 86%
12:00:07, 97%
12:00:08, 95%
12:00:09, 67%
12:00:10, 99%
];
left join load ValGlobal,Max(Val) as [Duration stayed above 90%] resident Tab group by ValGlobal;

output:

load Time ,CPU,if([Duration stayed above 90%]=1,'',[Duration stayed above 90%]&' secs') as [Duration stayed above 90%] resident Tab where PickTmp=1;

drop table Tab;

 

output:

Taoufiq_Zarra_0-1612777974666.png

 

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
dmohanty
Partner - Specialist
Partner - Specialist
Author

HI @Taoufiq_Zarra ,,

Thank you and appreciate your response here. 

I will give this a try, will understand and revert on this. 

Have a good time. 🙂 

Regards!

dmohanty
Partner - Specialist
Partner - Specialist
Author

Hi @Taoufiq_Zarra ,

Thank you for the ideas and help. This suggestion is working fine for me. Accepted it as a solution. 🙂