Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
upaliwije
Creator II
Creator II

Average Column

Hi Friends

I have following pivot tbal ein my QV document

NET_RANGE1JanFebMarAprMayJunJul
<=1000016151514161515
10,001-25,00057575857576354
25,001-50,00063666870667969
50,001-500,000158165182164165196189
Above 500,00151683790667787
Total345371360396369429415

I want add another column(avg) in between months of  May and Jun where total upto may divided by 5 should be shown. The resuting table should look like one given below

  

NET_RANGE1JanFebMarAprMayAvgJunJul
<=100001615151416151515
10,001-25,0005757585757576354
25,001-50,0006366687066667969
50,001-500,000158165182164165167196189
Above 500,0015168379066627787
Total345371360396369368429415

Pls help to do the above in Pivot table

2 Replies
its_anandrjs

Hi,

You can load this way

MonthMap: //Mapping Table used for data loading
Mapping
LOAD * Inline
[
Months,NMonth
Jan,1
Feb,2
Mar,3
Apr,4
May,5
Jun,6
Jul,7
]
;


SortOrder: //For New SortOrder with Avg column
LOAD * Inline
[
Months,SOrder
Jan,1
Feb,2
Mar,3
Apr,4
May,5
Avg,6
Jun,7
Jul,8
]
;


Data: //Main Fact table
LOAD NET_RANGE1,
Months,
ApplyMap('MonthMap',Months) as NMonth,
Values
FROM

(
ooxml, embedded labels, table is Sheet1);


//Load only data upto May and do calculation for the Avg
Join (Data)

LOAD
NET_RANGE1,
'Avg'
as  Months,
Sum(Values) / Count(Months) as Values
Resident Data
Where NMonth <= 5
Group By NET_RANGE1;


Output You get this way:-

avgCal.PNG


Regards

Anand

its_anandrjs

Did you check this solution for your Average problem.

Regards

Anand