cancel
Showing results for
Did you mean:
Highlighted
Frequent Visitor

## Measure to compute changes within same table

Hi All,

Would like to seek for some help here.

I have a series of weekly file with information similar to below table:

 Unique Key Week number Quarterly Forecast A01 1 84 A02 1 54 B01 1 135 C01 1 251 A01 2 107 B01 2 326 B02 2 181 C02 2 393 A01 3 247 A02 3 385 B01 3 395 C02 3 113

Can I create a measure to compute the difference of the same Primary (current week vs last week)?

For example, during week 4, what shown under Unique Key A01 will be the change from week 3 to week 4.

1 ACCEPTED SOLUTION

Accepted Solutions
Super User

Hi,

Hope this helps.

5 REPLIES 5
Super User

## Re: Measure to compute changes within same table

Hi,

Your question is not clear.  Show the expected result.

Frequent Visitor

## Re: Measure to compute changes within same table

Hi Ahish,

Thanks for replying. What I expected is:

Data Table (consists of series of weekly data)

 Primary Key Week Value A01 1 120 A01 2 170 A01 3 70 A01 4 100 A02 1 70 A02 2 100 A02 3 170 A02 4 130

Outcome:

 Primary Key Week 2 Week 3 Week 4 A01 50 -100 30 A02 30 70 -40

Week 2 = Difference in vallue for A01/A02 between Week 2 and Week 1 (Previous Week)

Week 3 = Difference in vallue for A01/A02 between Week 3 and Week 2 (Previous Week)

So I can plot either column chart or line chart to visualize the changes every week.

Super User

Hi,

Hope this helps.

Frequent Visitor

## Re: Measure to compute changes within same table

Thanks Ashish! It defintely helps here!

The only change I made is the week formula:

Previous formula makes it repeating from 1 to 4.

Week = QUOTIENT(
DATEDIFF(DATE(YEAR('Calendar Date'[Date]),1,1),'Calendar Date'[Date], DAY) +1
,7)