I have a column of years, months and a column of temperature of every month
I need to make the avarage between the same month of diferents years
Example:
The avarage of all the Januarys, Februarys.....
@Askquestioncan you share a sample data and the expected output ?
Month | Temperature
Jan/20 | 10
Fev/20 | 15
Jan/21 | 20
Fev/21 | 25
Output:
Month | Temperature | Month Avarage
Jan/20 | 10 | 15
Fev/20 | 15 | 20
Jan/21 | 20 | 15
Fev/21 | 25 | 20
data:
load
Date#(Month, 'MMM/YYYY') as MonthYear
,Month(Date#(Month, 'MMM/YYYY')) as Month
,Temperature;
load * inline [
Month, Temperature
Jan/20, 10
Feb/20, 15
Jan/21, 20
Feb/21, 25
];
left join (data)
load
Month,
avg(Temperature) as Month_Average
resident data
group by Month;
Very thank you it worked!
But there's a problem I forgot to say
I have 2 diferents cities and I need to calculate their months saparely with this method it made the avarage of both how can I fix it?
left join (data)
load
Month,
City,
avg(Temperature) as Month_Average
resident data
group by Month, City;
It worked very well thank you so much!!!!
you can simply load the data in the script and use aggr in your expression.
Avg(Aggr(Sum(Temp),Month,City)) this will work
Saniya.
Great. If you can please mark solution(s) so thread can be marked appropriately.