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: 
peterderrington
Creator II
Creator II

How to calculate an average reference line (in %) for a run chart

Hi,

I've created a simple run chart but have run into a small problem - i cant create the reference line mentioned above.

The graph itself is a simple bar/line chart with the line showing the compliance of a task by a given location in percentage form.

The expression for that line is:

Count({<Place={'C03'},[Questions Complete]={'Yes'},[Place transferred to]-={'C07'}>}Place)/Count({<Place={'C03'}, [Place transferred to]-={'C07'}>}Place) 

What i need to be able to do is show an average of that expression line on my chart.

Any ideas? Thanks, Peter

1 Solution

Accepted Solutions
peterderrington
Creator II
Creator II
Author

Ok, 

I found the solution. We were so close! Just needed to add TOTAL into the expression:

 

AVG(TOTAL AGGR(Count({<Place={'C03'},[Questions Complete]={'Yes'},[Place transferred to]-={'C07'}>}Place)/Count({<Place={'C03'}, [Place transferred to]-={'C07'}>}Place) , [Date]))

 

Thank you so much!

View solution in original post

5 Replies
Vegar
MVP
MVP

Try something like this:

AVG(AGGR(Count({<Place={'C03'},[Questions Complete]={'Yes'},[Place transferred to]-={'C07'}>}Place)/Count({<Place={'C03'}, [Place transferred to]-={'C07'}>}Place) , [Your X-axis Dimension]))
peterderrington
Creator II
Creator II
Author

Hi, 

 

Unfortunately it hasn't quite done it. 

The line should be a flat line across the graph showing (in this example) as 33.3%

Average.jpegAny ideas where to go next?

 

Thanks.

peterderrington
Creator II
Creator II
Author

I just double checked some of the properties of the chart and i'd forgotten to alter the position of the axis from Left to Right (to then match the compliance ratio axis), however when i changed it, it then just removed the compliance ratio expression and displayed this expression in exactly the same place.

Vegar
MVP
MVP

Do you get the correct total avg value if if you put your original expression into an textbox or chart without dimension?

If so then you could try this expression in your graph.

Count(TOTAL{<
Place={'C03'},
[Questions Complete]={'Yes'},
[Place transferred to]-={'C07'}>}Place)
/
Count(TOTAL{<
Place={'C03'},
[Place transferred to]-={'C07'}>}Place)
peterderrington
Creator II
Creator II
Author

Ok, 

I found the solution. We were so close! Just needed to add TOTAL into the expression:

 

AVG(TOTAL AGGR(Count({<Place={'C03'},[Questions Complete]={'Yes'},[Place transferred to]-={'C07'}>}Place)/Count({<Place={'C03'}, [Place transferred to]-={'C07'}>}Place) , [Date]))

 

Thank you so much!