Skip to main content
cancel
Showing results for 
Search instead 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.

Reply
sraj
Responsive Resident
Responsive Resident

Comparison based on current year week vs same week last year

Hi,

 

I dont have any data yet to provide but would like to know if this is possible and how would I do it?

 

Capture.PNG

 

Thanks!

1 ACCEPTED SOLUTION
v-xulin-mstf
Community Support
Community Support

Hi @sraj,

 

Is your issue solved? If the issue has been solved, please adopt the solution to help others.

You need a weeknum column to define the same period last year.

Just like:

Weeknum = 
CONCATENATE(YEAR('Table'[Date]),WEEKNUM('Table'[Date]))

Create measure as:

Measure = 
var _weeknum=CONCATENATE(YEAR(MAX('Table'[Date]))-1,MAX('Table'[Weeknum]))
return
CALCULATE(
    MAX('Table'[Value]),
    FILTER(
        'Table',
        'Table'[Weeknum]=_weeknum
    )
)

 

If you still have some question, please don't hesitate to let me known.‌‌

 

Best Regards,

Link

 

Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution. Really appreciate!

 

View solution in original post

2 REPLIES 2
v-xulin-mstf
Community Support
Community Support

Hi @sraj,

 

Is your issue solved? If the issue has been solved, please adopt the solution to help others.

You need a weeknum column to define the same period last year.

Just like:

Weeknum = 
CONCATENATE(YEAR('Table'[Date]),WEEKNUM('Table'[Date]))

Create measure as:

Measure = 
var _weeknum=CONCATENATE(YEAR(MAX('Table'[Date]))-1,MAX('Table'[Weeknum]))
return
CALCULATE(
    MAX('Table'[Value]),
    FILTER(
        'Table',
        'Table'[Weeknum]=_weeknum
    )
)

 

If you still have some question, please don't hesitate to let me known.‌‌

 

Best Regards,

Link

 

Is that the answer you're looking for? If this post helps, then please consider Accept it as the solution. Really appreciate!

 

amitchandak
Super User
Super User

@sraj , same week day is 364 days behind

 

example, with help from date table

Week Year behind Sales = CALCULATE(SUM(Sales[Sales Amount]),dateadd('Date'[Date],-364,Day))

 

how to deal with week vs week refer to my blog

 

It need a new column for week rank in date Table

 

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

 

measures examples
This Week = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])))
Last Week = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=max('Date'[Week Rank])-1))
Last year Week= CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Week Rank]=(max('Date'[Week Rank]) -52)))

 

 

Power BI — Week on Week and WTD
https://medium.com/@amitchandak.1978/power-bi-wtd-questions-time-intelligence-4-5-98c30fab69d3
https://community.powerbi.com/t5/Community-Blog/Week-Is-Not-So-Weak-WTD-Last-WTD-and-This-Week-vs-La...
https://www.youtube.com/watch?v=pnAesWxYgJ8

Helpful resources

Announcements
Microsoft Fabric Learn Together

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

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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