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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
Tani4ka
Helper I
Helper I

Same week last year doesn't work for all years

Hi All,

I'm trying to solve a problem of the same week last year measure not working correctly. As you can see from the snap below it doesn't show any data opposite to 2021 although data is there.

 

Tani4ka_0-1609756888441.png

 

This is my measure for the same week last year calcs:

 

Tani4ka_1-1609756930000.png

There are no filters so not sure what could it be. Any help would be highly appreciated.

Many thanks

T

5 REPLIES 5
amitchandak
Super User
Super User

@Tani4ka ,

it Better to create a week rank column.  In you date or week table(Create a separate one)

Create column like

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

 

Measures like
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))
Last year Week= CALCULATE(sum('order'[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

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
AllisonKennedy
Super User
Super User

@Tani4ka  Is [Sessions_Total] a measure? Your DAX should work as written and works in my test scenario, but something strange is happening with your Week Number, as you shouldn't have a result for the Year subtotals. 

 

Here is my test result. I have used Variables in the below measure, but get the exact same results pictured when using your exact measure: 

 

AllisonKennedy_0-1609759427248.png

 

Can you please provide more info on what fields you're using in the matrix, what your date table looks like and how it's related, and if [Sessions_Total] is a measure please provide the DAX for that too. 


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

The issue was that some of the data was in the wrong format in Excell since multiple people add different points.

 

The new issue I have with it that total for Sessions_LY doesn't show. 

Any suggestion of what could be wrong?

Tani4ka_1-1609947161659.png

Many thanks

T

 

 

Thanks a lot for a speedy response. I think I may know where the issue sits but still not sure how to resolve it.

 

In my model I have a few tables: 

1. has just one column with a brand name and is connected to other tables

2. date table

3. a few tables with diff data types but all have a matching brand column.

 

What I noticed if I remove brand filter which is from 'Brand' table all measures work. when I select a specific brand than it fails to work.  Since my data is in Excell I believe there's a formatting issue which I can't resolve. Any suggestion of what to do here?

Tani4ka_0-1609761694740.pngTani4ka_1-1609761737281.png

Many thanks

 

 

 

@Tani4ka , what is the formula you tried?

Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.