Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Flosom
Partner - Contributor III
Partner - Contributor III

Monthwise Average of First Month & Current Month

Hi Team,

I am in need of calculating monthwise average, where 

Average = (Jan value + Current Month Value) / 2

Eg: need values  in column Avg Val

Month Act Val Avg Val
Jan 10 10
Feb 15 12.5
Mar 25 17.5
Apr 40 25
May    
Jun    
Jul    
Aug    
Sep    
Oct    
Nov    
Dec    

 

But this doesn't happen as the Jan Value shows as zero in all subsequent months since the chart is monthwise.

Is there any method in set analysis to achieve the same.

 

thanks,

Florence

Labels (3)
3 Replies
MayilVahanan

HI

Try like below

(Sum([Act Val]) + Sum({<Month = {'Jan'}>}Total [Act Val]))/2

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Flosom
Partner - Contributor III
Partner - Contributor III
Author

In this case, i get below result:

Month Act Val Avg Val
Jan 10 10
Feb 15 12.5
Mar 25 17.5
Apr 40 25
May   5
Jun   5
Jul   5
Aug   5
Sep   5
Oct   5
Nov   5
Dec   5

 

but the avg value should come only upto April, which is the selected month. The remaining months should be zero.

MayilVahanan

Hi

Try like below

If(Sum([Act Val]) > 0, (Sum([Act Val]) + Sum({<Month = {'Jan'}>}Total [Act Val]))/2)

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.