Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Become an analytics expert with Qlik's new 15 week course: Applied Data Analytics using Qlik Sense. READ MORE
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

13 Replies
Vegar
Partner
Partner

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])

Plees ekskuse my Swenglish and or Norweglish spelling misstakes
marcus_sommer
MVP & Luminary
MVP & Luminary

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 & Luminary
MVP & Luminary

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 & Luminary
MVP & Luminary

Starts the variable vLineout_FCV_Win with an equal sign?

- Marcus

muthukumar77
Partner
Partner

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
Partner

Hi,

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