# New to QlikView

Discussion board where members can get started with QlikView.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
Contributor II

## SPC Chart - on median value

Hello

I am trying to build an SPC chart on the median value by week

But I do not know the best approach on how to build my chart

1) As I need to find my median shall I write this in the edit script as follows:

This creates an error in the expression

How would I write the UPPER CONTROL LIMIT based on the fact that a median needs to be calculated by week?

Any suggestions?

Kind Regards

Helen

1 Solution

Accepted Solutions
Honored Contributor II

## Re: SPC Chart - on median value

Hi.

To calculate your average value by week dimension (for upper control limit) you could use aggr() function:

Avg(aggr(IF([Patient Admitted?] = 1, [Total Wait])/1440), [WeekDimension]))

It calculates your if() expression for each [WeekDimension] value, then avg() aggregates these values.

For stdev() use the same approach.

2 Replies
Honored Contributor II

## Re: SPC Chart - on median value

Hi.

To calculate your average value by week dimension (for upper control limit) you could use aggr() function:

Avg(aggr(IF([Patient Admitted?] = 1, [Total Wait])/1440), [WeekDimension]))

It calculates your if() expression for each [WeekDimension] value, then avg() aggregates these values.

For stdev() use the same approach.

Contributor II

## Re: SPC Chart - on median value

Hello

Thank you for your help

Much appreciated.  This works a treat

Thanks

Helen