Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

Not applicable

Applying only the selections from one data field to the data set

Hello, I have a set expression formula like this:  Avg( {1<[Project Model Name] = {"$(#vProcessName)"}>} [Project Duration] ) .  This will take the average of [Project Duration] from the entire data set, ignoring all selected data values except for those where [Project Model Name] equals the value of the variable vProcessName.  This works well when there is only one selected value for [Project Model Name] that I can assign to the variable vProcessName.

I'm looking for a set expression that will allow me to apply multiple selections for [Project Model Name] and still ignore all the other selected data values in the data set.  Thanks!

 

4 Replies

Re: Applying only the selections from one data field to the data set

What is your expression for #vProcessName?

Can you check with this expr

Avg( {1<[Project Model Name] = {$(#vProcessName)}>} [Project Duration] )

Not applicable

Re: Applying only the selections from one data field to the data set

Here's the expression that sets vProcessName, it's on the OnActivateSheet event:

=GetFieldSelections([Project Model Name])

I tried your suggestion of removing the quotations from around the vProcessName expression and that

doesn't seem to work.

Re: Applying only the selections from one data field to the data set

Check with this expression

Avg( {1<[Project Model Name] = {$(vProcessName)}>} [Project Duration] )

if it doesn't works then change the variable expression to

vProcessName

=chr(39)&GetFieldSelections([Project Model Name],chr(39)&','&chr(39), 99)&chr(39)

Not applicable

Re: Applying only the selections from one data field to the data set

The updated formula didn't work and neither did the expression to set the vProcessName.  I tried modifing the formal to the following:

 

='('&chr(34)&GetFieldSelections([Project Model Name],chr(34)&'|'&chr(34), 99)&chr(34)&')'

This formula put the list in parentheses (), separated by pipes |, and it enclosed each selection value in quotations.  I thought this might work since this is the format you have to use to set a value of a data field.

Nothing seems to be working.

Community Browser