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
Anonymous
Not applicable

Return 1 for current week -1 in calculated column

Hi All, 

 

I have a calendar table below and I have a year week column that does not correspond to the normal weeknum formula as our week dates for the calendar is different. I would like to have a column stating "1" to show the YearWeek for last week. For e.g. this week is W32, i would like to show one week prior, W31, as "1". This is so that when i am showing my graph, it always shows the previous week as i would like to use this column to filter. 

evko_0-1629446097470.png

 

1 ACCEPTED SOLUTION
Fowmy
Super User
Super User

@Anonymous 
Add the following column:

Last Week = 
IF(
    YEAR(TODAY()-7) * 100 + WEEKNUM(TODAY()-7) = [Year Week],
    1
)

 

Fowmy_0-1629447963159.png

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

2 REPLIES 2
Fowmy
Super User
Super User

@Anonymous 
Add the following column:

Last Week = 
IF(
    YEAR(TODAY()-7) * 100 + WEEKNUM(TODAY()-7) = [Year Week],
    1
)

 

Fowmy_0-1629447963159.png

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

amitchandak
Super User
Super User

@Anonymous , expected output is not clear. Based on what I got so far

 

Week Type = Switch( True(),
weeknum([Date],1) && weeknum(Today()-7,1) ,1 ,
0
)

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.