Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
tatsuya0127
Contributor II
Contributor II

Show average only if you have a track record

tatsuya0127_0-1644817624978.png

How to display the average only for the months with a proven track record.
In the formula below, the average is displayed including the months without values.


Rangeavg(above(Sum({$<KPI={'TEST'},[KPI_Year]={$(tmpYear)},[KPI_Month]=>}Act),0,rowno()))


4 Replies
chris_djih
Creator III
Creator III

Add Act={"<>0"} to your set-analysis

If you found help, mark the correct answer and give some likes to ALL contributors, that tried to help.
tatsuya0127
Contributor II
Contributor II
Author

Thank you for your reply.

I tried what you taught me, but the result did not change.

It works at table chart.

 

regards,

 

 

chris_djih
Creator III
Creator III

Looking further into it, I think that rangeavg(above()) statement will always sum up each row.
If this is the case the only solution would be using if statement.
If( Len(trim(Acc))=0 or Acc =0, 0, rangeavg(above(...)) )
But i'n not convinced about the correctness of my thoughts. I think it would nevertheless take the zero values into account when calculating a second vlaue that have severela zero values between.

If you found help, mark the correct answer and give some likes to ALL contributors, that tried to help.
tatsuya0127
Contributor II
Contributor II
Author

Thank you for replying again.

I think it is difficult to use if statement.

I'll think of a different solution.

 

regards,