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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
MattN4
Helper I
Helper I

Compare YoY by weeknumber

Hi,

 

I've searched online but cannot find an answer.

 

We measure sales by week. In table 1 I simply have date, sales. In table 2 date and week number. I created a YoY calc by date with no issue using SAMEPERIODLASTYEAR, all worked fine. But of course I am now comparing a Monday with a Sunday or similar. When I remove the date from the visual I get an error as it expects a date and week number is not a date.

 

There does not seem to be a way to do a YoY for week number.

 

Thanks,

 

Matt

2 REPLIES 2
CheenuSing
Community Champion
Community Champion

Hi @MattN4

 

Please check out the thread wherein I have posted an alternative.

 

http://community.powerbi.com/t5/Desktop/Last-Year-This-Same-Week/m-p/164718#M71882

 

You mat find an answer.

 

Cheers

 

CheenuSing

Did I answer your question? Mark my post as a solution and also give KUDOS !

Proud to be a Datanaut!
v-yuezhe-msft
Employee
Employee

@MattN4,

Create the following columns in your table. Then create visual using YearWeek and your YOY measure.

Year = YEAR(Table[Date])
YearWeek = 'Table'[Year]&'Table'[WeekNumber]

There is also a blog about calculating YOY based on week number for your reference.
https://www.sqlbi.com/articles/week-based-time-intelligence-in-dax/

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors