Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

New Contributor III

Some help with first and last on count({set analysis} DISTINCT aggr(firstsortedvalue)))


On attached qvw I got some troubles on the table below :

Please see on the properties of the expression "Inpatient Counter on Item Value =2"

Starting from this expression:

=Count({<[Valor Item]={2},[Id Paciente]=P({<[Orden Form]={">=2"}>}[Id Paciente])>}DISTINCT Aggr(FirstSortedValue([Id Paciente],[Orden Form]),Bloque,Estudio,Centro))

I need a counter of distinct [Id Paciente] on first (or last) [Orden Form] --> FirstSortedValue([Id Paciente],[Orden Form]) where [Valor Item]=2 and for Possible [Id Paciente] with [Orden Form]>=2

My expression doesn't seem to be able to distinguish between first or last [Orden Form] encapsulated on

Aggr(FirstSortedValue([Id Paciente],[Orden Form]),Bloque,Estudio,Centro)

The result in expresion above should be 0 not 1 becase there is not any [Id Paciente] attached to [Valor Item]={2}

for selected item ("Otros problemas mentales o conductuales") on first [Orden Form] as you can see on the table below.

Thanks in advance


Mensaje editado por: Lander Uriarte