Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Join us at the Cloud Data and Analytics Tour! REGISTER TODAY
Showing results for 
Search instead for 
Did you mean: 
Contributor III
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

0 Replies