Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
slribeiro
Partner - Creator
Partner - Creator

Sum value by week (script)

Greetings, i'm having a little problem here.

I want to Sum the value by week and create a new column with that value.

I want to calculate this in script.

Table 1:

WeekYear     |     Value

2015/37         |     24

2015/37         |     30

2015/37         |     6

2015/37         |     0

2015/38         |     24

2015/38         |     24

2015/38         |     2

2015/38         |     6

Final Table:

WeekYear     |     Value     |     TotalValue/Week

2015/37         |     24          |     60

2015/37         |     30          |     60

2015/37         |     6            |     60

2015/37         |     0            |     60

2015/38         |     24          |     56

2015/38         |     24          |     56

2015/38         |     2            |     56

2015/38         |     6            |     56

Please help me if you can

Best regards

Simão Ribeiro

1 Solution

Accepted Solutions
sunny_talwar

Try this:

Table:

LOAD WeekYear,

          Value

FROM Source;

Left Join (Table)

LOAD WeekYear,

          Sum(Value) as [TotalValue/Week]

Resident Table

Group By WeekYear;

View solution in original post

4 Replies
sunny_talwar

Try this:

Table:

LOAD WeekYear,

          Value

FROM Source;

Left Join (Table)

LOAD WeekYear,

          Sum(Value) as [TotalValue/Week]

Resident Table

Group By WeekYear;

slribeiro
Partner - Creator
Partner - Creator
Author

Thank you a lot. It worked

MayilVahanan

Hi

Try like this

Try this:

Table1:

LOAD WeekYear,

          Value

FROM datasource;

Left Join (Table)

LOAD WeekYear,

          Sum(Value) as [TotalValue/Week]

Resident Table1

Group By WeekYear;

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Kushal_Chawda

Create the Straight Table with

Dimension:

1) WeekYear

2) Value

Expression:

sum(TOTAL <WeekYear> Value)