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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Current week based on custom field

Hi all,

I need some help with a calculated column. I have the following data:

DateWeekCustom weekValue
June 1725245
June 1825246
June 1925245
June 2026248
June 2126249
June 22262412
June 2326242
June 2426253
June 2526255
June 2626255
June 2727256
June 2827257
June 2927253
June 3027254
July 127265
July 227263
July 327263
July 428268
July 528269
July 628269
July 728261
July 828272



All data is for 2021 and new dates will be added in future. The week field - the week number starts from Sunday.

My custom week starts from Thursday. I need a Yes/No calculated column which I can use as a Slicer to return Yes/No for "Is current week"? (based on my custom week)

sc1.png

 



 

 

 

 

 

So the desired result should be; If I select from "Is current week"- 'Yes', a bar chart should return all values by dates for the current custom week (in this example 25 week- June 24 until June 30). If today is July 1st and the Current week is Yes - there should be values only for July 1st, and etc.

Thank you.

 

1 ACCEPTED SOLUTION
mahoneypat
Microsoft Employee
Microsoft Employee

You can add a DAX column using a pattern like this

 

CurrentWeek =
VAR todaydate =
    TODAY ()
VAR thisdate = 'Date'[Date]
VAR todayThursday =
    IF (
        WEEKDAY ( todaydate ) >= 5,
        todaydate - WEEKDAY ( todaydate ) + 5,
        todaydate - WEEKDAY ( todaydate ) - 2
    )
VAR thisThursday =
    IF (
        WEEKDAY ( thisdate ) >= 5,
        thisdate - WEEKDAY ( thisdate ) + 5,
        thisdate - WEEKDAY ( thisdate ) - 2
    )
RETURN
    IF ( todayThursday = thisThursday"Y""N" )

 
FYI that this would be easier in the query with M.  Also, please take a look at this article with some Date tables you could adapt, and then set your filter/slicer to Weeks from today as 0 (instead of "Y").
 
Pat




Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

1 REPLY 1
mahoneypat
Microsoft Employee
Microsoft Employee

You can add a DAX column using a pattern like this

 

CurrentWeek =
VAR todaydate =
    TODAY ()
VAR thisdate = 'Date'[Date]
VAR todayThursday =
    IF (
        WEEKDAY ( todaydate ) >= 5,
        todaydate - WEEKDAY ( todaydate ) + 5,
        todaydate - WEEKDAY ( todaydate ) - 2
    )
VAR thisThursday =
    IF (
        WEEKDAY ( thisdate ) >= 5,
        thisdate - WEEKDAY ( thisdate ) + 5,
        thisdate - WEEKDAY ( thisdate ) - 2
    )
RETURN
    IF ( todayThursday = thisThursday"Y""N" )

 
FYI that this would be easier in the query with M.  Also, please take a look at this article with some Date tables you could adapt, and then set your filter/slicer to Weeks from today as 0 (instead of "Y").
 
Pat




Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors