Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Congratulations to the new Qlik Luminary and Partner Ambassador class! Meet them here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Variable in Set Analysis

Hi all

I am struggling to get a variable in set analysis to return the correct amount

count({<[*Lineout Type]={'$(vLineout_FCV_Win)'}>} [*Lineout Type])

where

vLineout_FCV_Win = FirstSortedValue(DISTINCT [*Lineout Type],-aggr(count({<[*Result]={'Win'}>}[*Lineout Type])+rank([*Lineout Type],[*Lineout Type])/10,[*Lineout Type]))

Thanks

Labels (1)
13 Replies
Vegar
MVP
MVP

I  usually put my expression in a straight table with no column header. The expression will become the header and you will Gorky get an indication on what's wrong.

Have you tried the following expression?

count({<[*Lineout Type]={"$(=vLineout_FCV_Win)"}>} [*Lineout Type])

marcus_sommer
MVP
MVP

Starts the variable vLineout_FCV_Win with an equal sign? Does this variable return the expected value?

Quite helpful to see how an expression is evaluated is to use a table-chart for it and don't using a name for them and then viewing the evaluation within the expression-label.

- Marcus

Not applicable
Author

Hi there,

Yes, I have tried the expression and get the return of zero

Not applicable
Author

No, I get the error ''Error in set modifier ad hoc element list: ',' or ')' expected''

marcus_sommer
MVP
MVP

For the variable itself or for the expression with variable? Especially in such cases is it useful to look within the label how the expression will be evaluated and I would further split the approach into several steps by splitting the count- and aggr- and rank-functions to ensure they return the right results.

- Marcus

Not applicable
Author

For the expression with variable.

The variable itself is returning the correct amount

marcus_sommer
MVP
MVP

Starts the variable vLineout_FCV_Win with an equal sign?

- Marcus

muthukumar77
Partner - Creator III
Partner - Creator III

Hi,

1. Create variable,

vLineout_FCV_Win


[*Lineout Type]=FirstSortedValue(DISTINCT [*Lineout Type],-aggr(count({<[*Result]={'Win'}>}[*Lineout Type])+rank([*Lineout Type],[*Lineout Type])/10,[*Lineout Type]))


2. count({<$(vLineout_FCV_Win)>} [*Lineout Type])

Muthukumar Pandiyan
krishnacbe
Partner - Specialist III
Partner - Specialist III

Hi,

If your variable declaration is in Script, try with LET Statement instead of SET. Sometimes this will solve the issue.