Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
elie_issa
Creator II
Creator II

Use Total Function With Average And Aggr

Dear All,

Please help me to find a solution for the below :

I Need to get the average Ratio of last 26 weeks for each month and show it on a Line Chart Trend as shown in the below Screens.

Instead of showing 26.97% I need to show 26.03 % for May 2018 (average 26 weeks)

Also

Instead of showing 26.11% I need to show 25.65 % for Apr 2018 (average 26 weeks)

And the same for the other months.

Capture 2 May.PNGcapture 1 Apr.PNG

Expression :

avg({<Month = , Year = , [Month Year] = , [Week Year] = >}

aggr($(vNationalizationRatioLast26Weeks),Week , [Month Year],[Business Unit]))

Regards.

1 Solution

Accepted Solutions
sunny_talwar

I suggest you to use The As-Of Table if you are able to make changes in the script. If not, then you will need Missing Manual - Above() and Below() functions to solve this. Set Analysis isn't going to work here....

View solution in original post

14 Replies
arulsettu
Master III
Master III

can you share the expression stored in the variable possible with sample

Anil_Babu_Samineni

May be TOTAL keyword need to be added?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
elie_issa
Creator II
Creator II
Author

Yes I was thinking to Add the Total But it seems I am not adding it in the right place in my expression.

Can you please assist.

Thanks

elie_issa
Creator II
Creator II
Author

The variable is too much complicated and calling many other variables.

All I can do now is to find a solution using this variable.

Thanks.

arulsettu
Master III
Master III

try to include the TOTAL in the variable

Anil_Babu_Samineni

Can you place entire expression with TOTAL which you used? So then we may validate where yours is correct or not?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
nitin_01
Creator
Creator

Hi Elie,

        Try using : Avg(total Aggr(expression))

Regards,

Nitin G.

sunny_talwar

May be one of these

Avg(TOTAL Aggr(Avg({<Month, Year, [Month Year], [Week Year]>} Aggr($(vNationalizationRatioLast26Weeks), Week, [Month Year],[Business Unit])), [Month Year]))

or

Avg(TOTAL {<Month, Year, [Month Year], [Week Year]>} Aggr($(vNationalizationRatioLast26Weeks), [Month Year]))

elie_issa
Creator II
Creator II
Author

Hey Sunny,

I tried the two above expressions and they are giving the same % for all Months.

Even though the % is not correct.

So any other suggestion ?