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

GetFieldSelections and Max date in Set Analysis and AGGR

2018-09-19_14-44-40.jpg

How do I calculate the avg days per DEFECT_ID for the selected statuses?

2018-09-19_14-41-52.jpg

SUM(
Aggr(
Max(RES_STATUS_START_DATE)- Min(RES_STATUS_START_DATE)
,
DEFECT_ID)
)
  /
Count({$<DEFECT_ID = {"=Count(RES_STATUS_AND_MODE) = GetSelectedCount(RES_STATUS_AND_MODE)"}>}DISTINCT DEFECT_ID)

6 Replies
mdmukramali
Specialist III
Specialist III

Hi,

Can you attach sample data?

Thanks,

Mohammed Mukram

cbaqir
Specialist II
Specialist II
Author

Sample attached

If I used RES_STATUS (the one NOT in AND_MODE) I get two days.

I need the RES_STATUS_AND_MODE to show 2 days.

Anonymous
Not applicable

hi,

try this

avg(Aggr(Max(RES_STATUS_START_DATE)- Min(RES_STATUS_START_DATE),DEFECT_ID))

cbaqir
Specialist II
Specialist II
Author

That gives me the same result. I think it needs to be filtered by GetFieldSelections(RES_STATUS_AND_MODE)

Anonymous
Not applicable

shouldn't need filter on RES_STATUS_AND_MODE as this selection is already considered

cbaqir
Specialist II
Specialist II
Author

I need to get the Max start date from one status and the min start date from the other. In the example, it should be 2 days.