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: 
Anonymous
Not applicable

AVG above several values

Hello qlikers 🙂 ,

 

I think a picture says more than words:

Unbenannt6.PNG

I have three coloums. I want to create the AVG of the number, but dependent on plant and the date, date is MM/YYYY. I want to do this in the load script. How can I generate the AVG of the number ? Later I want to build a line chart with the AVG and the date. For example red = Apr18 / AVG 6.

I hope someone could help me. Looking forward to your answer! Thank you in advance! 🙂

 

Labels (2)
1 Solution

Accepted Solutions
Anil_Babu_Samineni

Cool, Try this

Table:
Load Plant, Date, Number From Table;

Left Join (Table)
Load Date, Avg(Number) as AVG Resident Table Group By Date;

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

View solution in original post

6 Replies
Anil_Babu_Samineni

Try to explain one part like Yellow color how the 2.6 is the expected?

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
Anonymous
Not applicable
Author

Yellow = 

Plant 1 | Jan 18 | 1
Plant 2 | Jan 18 | 2 +
Plant 3 | Jan 18 | 4 =

7 / 3 = 2,3333 (sorry, 2,666667 is wrong, yellow avg should be 2,3333)

 

Did it help?

Anil_Babu_Samineni

Cool, Try this

Table:
Load Plant, Date, Number From Table;

Left Join (Table)
Load Date, Avg(Number) as AVG Resident Table Group By Date;

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
Anonymous
Not applicable
Author

Thank you very much for this quick answer! But unfortunately the plant is not included. 

Should I included the plant in the group by? 

 

Table: Load Plant,
Date, Number
From Table;

Left Join (Table)
Load
Date,
Avg(Number) as AVG
Resident Table
Group By Date
And Plant;

Thank you in advance! 🙂

Anil_Babu_Samineni

FYI: Group By works on row based hence as per output needed the solution will work. If you simply copy paste? Is that something not working?

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
Anonymous
Not applicable
Author

I'm sorry. Thank you very much. That worked! 🙂