cancel
Showing results for
Did you mean:
Frequent Visitor

## Sum acumulated

Hi!
I have a question a little complex, I have a base for weeks (can not have for days) of 3 full years, each week has assigned a number of days (for example the week 51 is assigned with 52304 days), I need for each week to sum a year to the back, that is, for week 51 sum from week 52 of 2017 to week 51 of 2018, and so on for all the weeks of the last 2 years. Any ideas?

4 REPLIES 4
Super User

## Re: Sum acumulated

Sample data would really assist here along with your expected output. Probably can get there with some variation on my Time Intelligence The Hard Way Quick Measure, but would need to see how your data is laid out. So, for example, do your week numbers range from 0-53 and you have a year column as well or are they assigned 0-150(ish)? What do the assigned number of days mean, is that cumulative or something?

Proud to be a Datanaut!

Frequent Visitor

## Re: Sum acumulated

The days is like a random data, and is not acumulative.

Here is a sample data:

 Year_dp Month_dp Week-DP daysbyweek Sede 2017 3 13 0 a 2017 3 13 12 b 2017 3 14 0 c 2017 3 12 20 d 2017 3 10 19 d 2017 3 11 0 b 2017 3 14 0 a 2017 3 13 13 b 2017 3 10 0 c 2017 3 13 0 d 2017 3 14 49 d 2017 3 10 25 b 2017 3 13 25 a 2017 3 14 0 b 2017 3 11 1 c 2017 3 11 0 d 2017 3 13 0 d 2017 3 12 0 b 2017 3 14 24 a 2017 3 11 0 b 2017 3 11 0 a 2017 3 12 0 b 2017 3 12 0 c 2017 3 11 0 d 2017 3 13 14 d 2017 3 11 0 b 2017 3 10 0 a 2017 3 12 0 b 2017 3 10 0 c 2017 3 13 0 d 2017 3 13 0 d 2017 3 10 0 a 2017 3 12 0 b 2017 3 11 0 c 2017 3 10 0 d 2017 3 14 0 d 2017 3 13 36 b 2017 3 14 0 a 2017 3 11 0 b 2017 3 10 0 c 2017 3 13 0 d 2017 3 12 0 d 2017 3 11 0 a 2017 3 14 12 b 2017 3 12 0 c 2017 3 11 0 d 2017 3 12 0 d 2017 3 11 0 b 2017 3 14 0 a 2017 3 12 0 b 2017 3 10 0 c 2017 3 11 0 d 2017 3 13 0 d 2017 3 13 29 a 2017 3 12 0 b 2017 3 10 0 c 2017 3 13 0 d 2017 3 11 0 d 2017 3 11 0 b 2017 3 14 0 a 2017 3 12 0 b 2017 3 12 165 c 2017 3 10 0 d 2017 3 10 0 d 2017 3 10 0 a 2017 3 14 0 b 2017 3 12 0 c 2017 3 13 0 d 2017 3 12 0 d
Frequent Visitor

## Re: Sum acumulated

Hi!

The number days is not acumulative, is like a random number for eachs week.

Here is a data example:

Year   Month   Week   days   Sede

2017      7          42      254      a

2017      7          42      2          b

2018      8          44      13        c

2016      7          42      15        a

2016      8          44      24        a

2018 7 43 0 b

So, for each week i have to sum the Days of the 52 before week for all the "Sedes".

For week 41 2018 i need to sum the days from week 42 2017 to week 41 2028

For week 35 2018 i need to sum the days from week 36 2017 to week 35 2028

Community Support Team

## Re: Sum acumulated

HI @fsalinass,

I write a measure to calculate total 'daysofweeks' based on current year, week and grouped by sede, maybe you can try it if it works.

```Measure =
VAR currYear =
MAX ( Table1[Year_dp] )
VAR currWeek =
MAX ( Table1[Week-DP] )
RETURN
CALCULATE (
SUM ( Table1[daysbyweek] ),
FILTER (
ALLSELECTED ( Table1 ),
OR (
[Year_dp] = currYear
&& [Week-DP] <= currWeek,
[Year_dp]
= currYear - 1
&& [Week-DP]
> currWeek - 1
)
),
VALUES ( Table1[Sede] )
)
```