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

Aggregate over an expression

I'm new in qlik and I'm trying to accomplish the following request with no luck, I hope someone can give some ideas:

My issue is having a % value calculated based 2 columns by Year and Week:

Year     Week          Value 1               Value 2          %

year     week           sum(x)                sum(y)           [Value 1] / [Value 2]

The results having year and week in the chart works fine, but now I would like to create a second chart having only Year and % where the percentage is not really the natural aggregation of this value, i would like to have an average of the results.

having this data:

Yearweek_idKeyIdTotal Misc SalesTotal Dept Sales%
Year FY162016484$19,583.85$2,209,132.250.89%
Year FY162016494$0.00$5,157,718.870.00%
Year FY162016504$286.20$4,360,959.950.01%
Year FY162016514$8.50$3,736,121.040.00%
Year FY162016524$7.99$1,308,088.040.00%
$19,886.54$3,354,404.030.12%



I would like to get

YearKeyId%
Year FY1640.18%

Where 0.18% is the Average of % values divided of number of weeks

But Qlik will give me:

YearKeyId%
Year FY1640.12%

Any ideas will help

Thanks

Darlene

1 Reply
sunny_talwar

May be try like this:

Avg(Aggr(Sum(x), Year, week_id))/Avg(Aggr(Sum(y), Year, week_id))