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: 
Subhasmita
Partner - Contributor
Partner - Contributor

Avg function considering non-actualized weeks

Hi Experts,

 

Need help in calculation for a certain scenario. I have two dimension Quarter and Week. For Week calculation, need to show sum of prod list amount, however for Quarter calculation, need to show average of Week's sum.

I have used below formula, however not getting desired result.

if(Dimensionality()=1,
Avg(Aggr(Sum([Prod List Amount])/1000000,[Fiscal Week Number])),
Sum([Prod List Amount])/1000000)

From following table, i'm able to achieve column 2 which is not correct(above formula considers the weeks which are not yet actualized for quarter), however need to have Column3 result(it should consider for average, only 2 weeks). Please help.

Column1Coulmn2Column3
Q1-20219.2360
Week17070
Week25050
Week300
Week400
Week500
Week600
Week700
Week800
Week900
Week1000
Week1100
Week1200
Week1300

 

 

Thanks,

Subha

Labels (2)
1 Solution

Accepted Solutions
PriyankaShivhare
Creator II
Creator II

U need to exclude the weeks where the sum of Amount is zero
if(Dimensionality()=1,
Avg({<[Fiscal Week Number]={"=Sum([Prod List Amount])>0"}>}Aggr(Sum([Prod List Amount])/1000000,[Fiscal Week Number])),
Sum([Prod List Amount])/1000000)

Thanks,
Priyanka

View solution in original post

2 Replies
PriyankaShivhare
Creator II
Creator II

U need to exclude the weeks where the sum of Amount is zero
if(Dimensionality()=1,
Avg({<[Fiscal Week Number]={"=Sum([Prod List Amount])>0"}>}Aggr(Sum([Prod List Amount])/1000000,[Fiscal Week Number])),
Sum([Prod List Amount])/1000000)

Thanks,
Priyanka
Subhasmita
Partner - Contributor
Partner - Contributor
Author

that made the trick!

 

thanks a lot! 🙂