Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Average weeks waited


Hi, I need to work out an average weeks patients have waited. So i have the number of patients (metric_value) and the amount of weeks waited per patient (weeks_metric), and i want to show on average how long patients wait to be seen in th hospital.

I used this:

avg (total  {$<Metric_Code={'RTT21'}>} Metric_Value  )

but i dont know how to fdit in the by weeks metric. this just shows admitted patients (RTT21) as a whole.

Please can you help? I imagine its something like

avg (total  {$<Metric_Code={'RTT21'}>} Metric_Value , weeks_metric) ??

Thanks,

6 Replies
pokassov
Specialist
Specialist

Hello, Kate!

Dimension:

Metric_Code

Expression:

sum(Metric_Value)/sum(weeks_metric)

Not applicable
Author

Thanks, but that doesnt give what i need...

How would you type that in?

sum ( {$<Metric_Code={'RTT21'}>} Metric_Value) / sum ( weeks_metric )

This comes out 0.02 which is nowhere near the average amount of weeks a patient waits.

Thanks,

pokassov
Specialist
Specialist

can you attach your model?

Not applicable
Author

What do you mean? This is the code for the load, which is the same for all our tables, the metric_vlaue is a count of patient id and the weeks_metric is worked out using days waited and then how many weeks they waited. I just want to try and work out, out off all the patients (which have a week metric attached to them) how long they waited on average.

,

   
"fk_calendar" as Calendar_ID,

   
"fk_consultant" as Consultant_ID,

   
"fk_gp" as GP_ID,

   
"fk_metric" as %Metric_ID,

    1
as Outcome_ID,

    1   
as Priority_ID,

    1
as Source_Of_Ref_ID,

   
"fk_Specialty" as Specialty_ID,

   
"Metric_Value",

   
"Patient_type",

   
"Metric_Part",

  
"Activity_Date",

 
"weeks_metric",

Thanks,
    

pokassov
Specialist
Specialist

Can you post a qlikview document that demonstrates the problem?

miikkaqlick
Partner - Creator II
Partner - Creator II

Hi!

As I understood your data is like this:

SetData:

Load * Inline [

Week, Metric_Value, Weeks_Metric

1, 3, 8

2, 4, 9

3, 2, 6

4, 3, 6

5, 7, 12

];

In that case:

=Sum(Weeks_Metric)/Sum(Metric_Value)

If you write Total to aggregate function it will calculate through all values. With my data Sum(Total Metric_Value) will give number of patients for all weeks (19) for every row.

Br,

Miikka

Climber Finland