Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Anonymous
Not applicable

Calendar Week Comparison to last year with a calculation group

Hi everyone, 

 

I am trying to write a calculation group which calculates the selected measure in the same calendar week from the last year. 

 

This is how it looks in the Report: (I recreated this in Excel with imaginary numbers to secure customer data) 

Michella_0-1641375782993.png

 

I have the yearweek slicer and depending on what month i choose there, my table will calculate. 

 

It is a matrix table with the comparison calculation in the columns and the different KPIs (revenue, Klicks, CTR) as values. The KPIs are simple Sum Calculations.

 

The problem is that I tried to validate my data but I got a value  for the prior year of +54% when in reality it should be -35%. So I think I maybe did something wrong in the calculations.

 

Now I do realize in my calculations are two different calendars, but that is intentional, we need those two in the report and as I understand we wrote the calculation to work on both calendars.

The format of JahrKWSonntag (which is YearWeek) is 202109, etc.

 

My current calculation grouup consints of two calculations:

Actual =

VAR _CURRENT_YEARWEEKSUNDAY =
SELECTEDVALUE ( 'Kalender 2'[JahrKWSonntag] )

RETURN

CALCULATE (

SELECTEDMEASURE (),
KEEPFILTERS (

FILTER (

ALL ( 'Kalender' ),
[JahrKWSonntag] = _CURRENT_YEARWEEKSUNDAY
)

)

)

 

Prior Year

 

VAR _CURRENT_YEARWEEKSUNDAY =
SELECTEDVALUE ( 'Kalender 2'[JahrKWSonntag] )

 

VAR _VJ =

CALCULATE (

SELECTEDMEASURE (),
KEEPFILTERS (

CALCULATETABLE (

FILTER (

ALL ( 'Kalender' ),
[JahrKWSonntag] = _CURRENT_YEARWEEKSUNDAY - 100
)

)

)

)

RETURN

DIVIDE (

CALCULATE (

SELECTEDMEASURE (),
KEEPFILTERS (

FILTER (

ALL ( 'Kalender' ),
[JahrKWSonntag] = _CURRENT_YEARWEEKSUNDAY
)

)

) - _VJ,
_VJ

)

 

 

@tabulareditor @calculationgroup

1 REPLY 1
ValtteriN
Super User
Super User

Hi,

Here is a good discussion about a similar topic:
 https://forum.enterprisedna.co/t/same-period-last-year-for-fiscal-week-nbr-weeks-in-sales-table-are-...

In essence something like this should work:

Previous Year Same Week Calc group=
VAR CurrentMonth = SELECTEDVALUE( Dates[Week Number] )
VAR CurrentYear = SELECTEDVALUE( Dates[Year] ) RETURN
CALCULATE( SELECTEDMEASURE (), FILTER( ALL( Dates ), Dates[Week Number] = CurrentMonth && Dates[Year] = CurrentYear - 1))

I hope this helps to solve your issue and if it does consider accepting this as a solution and giving the post a thumbs up!





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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