Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

cancel
Showing results for 
Search instead for 
Did you mean: 
mattphillip
Creator
Creator

User defined field within expression

Hoping someone can help. I have an expression for calculating percentages within a table where users can define the visible fields:

=count({$<[Retained]={'Yes'}>}[Student ID])/count(TOTAL <GetFieldSelections(Fields)> [Student ID])

The getfieldselections statement is meant to allow users to specify what the context of the calculated percentage e.g. by programme, gender, session etc. However when I try this, the calculation is blank.

Does anyone know where I might be going wrong?

Appreciated.

Matt

1 Solution

Accepted Solutions
sunny_talwar

May be try this

=Count({$<[Retained]={'Yes'}>}[Student ID])/Count(TOTAL <$(='[' & GetFieldSelections(Fields, '], [') & ']')> [Student ID])

View solution in original post

7 Replies
sunny_talwar

May be try this

=Count({$<[Retained]={'Yes'}>}[Student ID])/Count(TOTAL <$(='[' & GetFieldSelections(Fields) & ']')> [Student ID])

mattphillip
Creator
Creator
Author

Thanks Sunny that does work! One question though, is there a way for it to accept multiple selections? E.g. selecting session and gender to display a percentage which adds up to 100% for each session.

Thanks,

sunny_talwar

May be try this

=Count({$<[Retained]={'Yes'}>}[Student ID])/Count(TOTAL <$(='[' & GetFieldSelections(Fields, '], [') & ']')> [Student ID])

mattphillip
Creator
Creator
Author

Brilliant thanks!

mattphillip
Creator
Creator
Author

Hi Sunny,

Hoping you might be able to help with a quick question, I'm trying to add in an additional set analysis criteria (specifying a particular session) to the above expression but it's throwing up errors. Any ideas why?

=count({$<[Retained]={'Yes'},[Session]={'2015/16'}>}[Student ID])/count(TOTAL <{$(='[' & GetFieldSelections(Fields, '], [') & ']'),[Session]={'2015/16'}>}[Student ID])

Many thanks,

Matt

sunny_talwar

Because what I added was not set analysis, it was field name used by TOTAL qualifier... try this

=Count({$<[Retained]={'Yes'}, [Session]={'2015/16'}>} [Student ID])/Count({<[Session]={'2015/16'}>} TOTAL <$(='[' & GetFieldSelections(Fields, '], [') & ']')> [Student ID])

mattphillip
Creator
Creator
Author

Its been a long day...thanks Sunny, much appreciated!