Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Shabnam123
Contributor II
Contributor II

Aggr Issue

I am trying to count the number of times a process ran, completed nd was successful based on the process status. Now a process has multiple jobs within it, so in the table, process_start_timestamp and process_status has similar values for multiple columns. I want to do a group by (aggressive) function and select the process_status group by process_start_timestamp so that process_status is counted once per process_timestamp. how to achieve that?

This expression is giving wrong answer:

Count(

If(
Aggr(process_strt_timestamp, process_status) = process_strt_timestamp,

process_status
)
)

Labels (2)
1 Solution

Accepted Solutions
TauseefKhan
Creator III
Creator III

Hi @Shabnam123,

Dimension: Set the dimension to process_status.
Measure: Use the following measure.

 
Count(Distinct Aggr(process_strt_tm, process_id, process_strt_tm, process_status))

 

TauseefKhan_0-1719060321598.png



View solution in original post

4 Replies
rubenmarin

Hi, for better understandding it would be nice if you can add some sample data that is similar to your case.

So far I can tell you that aggr will return many differnt values, and you can't compare many to one, maybe you only need to include the if inside the aggr, and make the aggr to iterate by both fields

Count(Aggr(
If(process_status=process_strt_timestamp,process_strt_timestamp)
,process_status,process_strt_timestamp))

 

Shabnam123
Contributor II
Contributor II
Author

I just want to  select 1 process status per process_strt_tm. Basically perform perform group by function on process_start_tm. how to do that?

 

Shabnam123
Contributor II
Contributor II
Author

Want to plot a bar graph on process status/9Running, Completed, Failed). What to add in dimension and measure?

process_id process_strt_tm process_end_tm process_status
1 12/01/24 5:30 12/01/24 7:30 Failed
1 12/01/24 5:30 12/01/24 7:30 Failed
1 12/01/24 5:30 12/01/24 7:30 Failed
1 14/01/24 6:30 14/01/24 7:30 Completed
1 14/01/24 6:30 14/01/24 7:30 Completed
2 12/01/24 5:30 12/01/24 7:30 Completed
2 12/01/24 5:30 12/01/24 7:30 Completed

This data without any filter should display 2 bars of length completed=2 and Failed=1. Please help.

TauseefKhan
Creator III
Creator III

Hi @Shabnam123,

Dimension: Set the dimension to process_status.
Measure: Use the following measure.

 
Count(Distinct Aggr(process_strt_tm, process_id, process_strt_tm, process_status))

 

TauseefKhan_0-1719060321598.png