Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
jessbanaga
Contributor II
Contributor II

Average between different multiple dimensions

Using Pivot table where dimensions W45 to W50 serve as dimension headers. I created two fact measures - Tot Hours and Avg. Hours  where Tot Hours expression SUM(Hours) which results the values from W45 to W50

Pivot Table

CustCategW45W46W47W48W49W50
ATot Hours403040402050
AAvg Hours3032.50343535.736.25

 

AvgTbl

CustCategW42W43W44W45W46W47W48W49W50
AAvg Hours203040404040404040

 

Formula to get Avg Hours for the Categ column of the Pivot Table:

W45 = Average(AvgTbl.W42 to AvgTbl.W44) = 30

W46 = Average(AvgTbl.W42 to AvgTbl.W45) = 32.5

W47 = Average(AvgTbl.W42 to AvgTbl.W46) = 34

W48 = Average(AvgTbl.W42 to AvgTbl.W47) = 35

W49 = Average(AvgTbl.W42 ... AvgTbl.W48) = 35.7

W50 = Average(AvgTbl.W42 ... AvgTbl.W49) = 36.25

I tried this expression to get Avg Hours:

SUM(AGGR(AVG( {< [Week] = {"=[Week] >= $(vStartWeek) AND [Week] < $(vEndWeek)" }>} [Hours]), [Cust],[Week]))

Unfortunately it's not working.

The attached files are not exactly the same how it is laid-out here. But the context is very much the same.

Labels (1)
1 Reply
edwin
Master II
Master II

look at your data again, you may have attached the wrong XLS.  looking at the file, average of week 42 to 45 is 30 not 32.5/  in fact all your running averages are all 30 since you have the same numbers for all the weeks (for Cust A).  sum for Cust A for all weeks is 60.