Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Group by on a Date..

Hello all!

I have a table with currency rates per day and I would like to calculate an average rate per month. Why doesnt my script below work?

The currency rate table (tmpCurrencyRates) looks like this:

Date, USD,DKK,NOK

2009-02-03 1,232 4,123 2,341

2009-02-04 1,543 4,765 2,567

---------------------------------------

script:

CurrencyRates:

load

date(date#(left(Date, 7), 'YYYY-MM'), 'YYYY-MM') as CurrencyPeriod,

avg(USD) as aUSD,

avg(DKK) as aDKK,

avg(NOK) as aNOK

resident tmpCurrencyRates

group by CurrencyPeriod;



Br

Cristian

1 Solution

Accepted Solutions
Not applicable
Author

try with

CurrencyRates:

load

date(date#(left(Date, 7), 'YYYY-MM'), 'YYYY-MM') as CurrencyPeriod,

avg(USD) as aUSD,

avg(DKK) as aDKK,

avg(NOK) as aNOK

resident tmpCurrencyRates

group by date(date#(left(Date, 7), 'YYYY-MM'), 'YYYY-MM');

View solution in original post

2 Replies
Not applicable
Author

try with

CurrencyRates:

load

date(date#(left(Date, 7), 'YYYY-MM'), 'YYYY-MM') as CurrencyPeriod,

avg(USD) as aUSD,

avg(DKK) as aDKK,

avg(NOK) as aNOK

resident tmpCurrencyRates

group by date(date#(left(Date, 7), 'YYYY-MM'), 'YYYY-MM');

Not applicable
Author

Worked great! Thank you!

Br

Cristian