Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

AVERAGE BY MAXIMUM VALUE

Hi there!

I'm a bit lost , so i hope someone of you will give me light about the question below.

I got this example to explain the logic:

CENTRE IDPATIENT IDMESSURE ORDER TEMPERATURE
A10138,4
A11137,4
B21139,2
B22137,5
B22236,6
A10238,2
A11237,3
B21238,6
B21337,4
A10337
A11336,2
B21436,8
A10436,6

I need to know the (average of temperature by (maximum messure order by patient ID)).

I don´t wanna need to show the "Patient ID' field in the result which should be something like this:

CENTRETEMP. AVG
A36,4
B36,7

Regards,

Lan

1 Solution

Accepted Solutions
tresesco
MVP
MVP

Expression:

=Avg(Aggr(FirstSortedValue(TEMPERATURE,-[MESSURE ORDER]), [CENTRE ID],[PATIENT ID]))

PFA

View solution in original post

7 Replies
MK_QSL
MVP
MVP

Can you elaborate your logic in more detail please?

Anonymous
Not applicable
Author

OK! I´m sorry about my english, when I said messure I meant to say measure.

Lets go...

There are 2 centres A and B.

Each centre got X inpatients (2 in the A and 2 in the B in this case).

I took the temperature several times for each patient (not the same times per each).

So i need to know the average of the temperature for the patients only for the last time i took the messure (being the last time, the maximum measure time of the temperature).

tresesco
MVP
MVP

Expression:

=Avg(Aggr(FirstSortedValue(TEMPERATURE,-[MESSURE ORDER]), [CENTRE ID],[PATIENT ID]))

PFA

Not applicable
Author

Hi,

Pls look into the attached qvw and let me know if this is what expected.

Thanks,

Prabhu

MK_QSL
MVP
MVP

Tresesco reached before me...

Dimension = [CENTRE ID]

Expression

Avg(Aggr(FirstSortedValue(TEMPERATURE,-[MESSURE ORDER]),[PATIENT ID],[CENTRE ID]))

Anonymous
Not applicable
Author

Actually the qvw works but i'm trying to check the logic in my enviroment, which much more complicated. 

Anonymous
Not applicable
Author

Hi tresesco,

Could you help me on this?

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

I got some troubles with this expression calculating the value on first or last [Orden Form]

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

Please, if you can help me let me know if you need any added information.

I will appreciate a lot any assistance.

Regards,

Lander