cancel
Showing results for
Did you mean:
New Member

## Calculate difference in values from the current week

Hello

I would like to calculate by formula, the difference in "Calls..." either in values or in %, from last week - the previous one, by category.

For example with this last week (53_20)-(52_20).

NOTE: I have an index that sorts those weeks chronologically.

2 ACCEPTED SOLUTIONS
Community Support

Hi @dmorala2 ,

Unfortunately, the picture is too vague to provide valid information.

Based on your description, I have created a test file for your reference. The measure is as follows:

``````Measure =
var this_index = MAX('Table'[Index])
var last_week = CALCULATE(
SUM('Table'[value]),
FILTER(ALLEXCEPT('Table','Table'[category]),'Table'[Index]=this_index-1))
var this_week = SUM('Table'[value])
return this_week-last_week``````

Sample .pbix

Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

New Member

Gracias a los 2,

LastW = CALCULATE(sum('WEEK Skyline'[Calls SK]), FILTER(ALLSELECTED('WEEK Skyline'), 'WEEK Skyline'[INDICE]=max('WEEK Skyline'[INDICE])-1))
ThisW = CALCULATE(sum('WEEK Skyline'[Calls SK]), FILTER(ALLSELECTED('WEEK Skyline'), 'WEEK Skyline'[INDICE]=max('WEEK Skyline'[INDICE])))

ThisVSLast = [ThisW] - [LastW]

3 REPLIES 3
New Member

Gracias a los 2,

LastW = CALCULATE(sum('WEEK Skyline'[Calls SK]), FILTER(ALLSELECTED('WEEK Skyline'), 'WEEK Skyline'[INDICE]=max('WEEK Skyline'[INDICE])-1))
ThisW = CALCULATE(sum('WEEK Skyline'[Calls SK]), FILTER(ALLSELECTED('WEEK Skyline'), 'WEEK Skyline'[INDICE]=max('WEEK Skyline'[INDICE])))

ThisVSLast = [ThisW] - [LastW]

Community Support

Hi @dmorala2 ,

Unfortunately, the picture is too vague to provide valid information.

Based on your description, I have created a test file for your reference. The measure is as follows:

``````Measure =
var this_index = MAX('Table'[Index])
var last_week = CALCULATE(
SUM('Table'[value]),
FILTER(ALLEXCEPT('Table','Table'[category]),'Table'[Index]=this_index-1))
var this_week = SUM('Table'[value])
return this_week-last_week``````

Sample .pbix

Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Super User IV

@dmorala2 , In case you need measure, Create a date or week table (separate) with week rank and use that

new column

Week Rank = RANKX(all('Date'),'Date'[Year Week],,ASC,Dense)

measure
This Week = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])))
Last Week = CALCULATE(sum('order'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])-1))

Proud to be a Super User!

Announcements

#### Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks