cancel
Showing results for
Did you mean:

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Frequent Visitor

## accumulate by week and year

Hi,

I have a dataset where I want to calculate a running total of items orderes pr. week and compare it with

items ordered for the same week the year before. I need to see it sorted by the days in advanced the items

are ordered and year vs year. I cant seems to get it to work as it accumulates the numbers for both years.

Anyone who could help?

1 ACCEPTED SOLUTION
Employee

Hi @Johnrevheim,

In your SPREADSHEET table, the Days before is missing out. While in your wanted result, the Days before values are continious?

Please add ALLEXCEPT function in filter of your formula. And create a matrix used to display what you want.

I try to reproduce, and I use your sample data table.

Create a measure using the formula.

`RunningTotal = CALCULATE(SUM(SPREADSHEET[items]),FILTER(ALLEXCEPT(SPREADSHEET,SPREADSHEET[Year]),SPREADSHEET[Days before]>=MAX(SPREADSHEET[Days before])))`

Finally, create a matrix, select the days before as Rows level, Year as Column level, please see the following screenshot.

Best Regards,
Angelia

2 REPLIES 2
Frequent Visitor

Thank you very much. The days before is a running series in the original dataset.

Employee

Hi @Johnrevheim,

In your SPREADSHEET table, the Days before is missing out. While in your wanted result, the Days before values are continious?

Please add ALLEXCEPT function in filter of your formula. And create a matrix used to display what you want.

I try to reproduce, and I use your sample data table.

Create a measure using the formula.

`RunningTotal = CALCULATE(SUM(SPREADSHEET[items]),FILTER(ALLEXCEPT(SPREADSHEET,SPREADSHEET[Year]),SPREADSHEET[Days before]>=MAX(SPREADSHEET[Days before])))`

Finally, create a matrix, select the days before as Rows level, Year as Column level, please see the following screenshot.

Best Regards,
Angelia

Announcements

#### Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

#### Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

#### Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors