Qlik Community

QlikView Layout & Visualizations

Discussion Board for collaboration on QlikView Layout & Visualizations.

Highlighted
cbaqirdhds
Valued Contributor

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
Valued Contributor III

Re: Days between two selected values

Hi,

Can you attach sample data?

Thanks,

Mohammed Mukram

cbaqirdhds
Valued Contributor

Re: Days between two selected values

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.

sbobbyraj
Contributor III

Re: GetFieldSelections and Max date in Set Analysis and AGGR

hi,

try this

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

cbaqirdhds
Valued Contributor

Re: GetFieldSelections and Max date in Set Analysis and AGGR

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

sbobbyraj
Contributor III

Re: GetFieldSelections and Max date in Set Analysis and AGGR

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

cbaqirdhds
Valued Contributor

Re: GetFieldSelections and Max date in Set Analysis and AGGR

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.