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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
pstanek
Post Patron
Post Patron

Need help creating number of week

Hi I use direct query within Power BI  and WEEKNUM doesn´t work because Calculated column dax formrmula doesn´t support WEEKNUM in direct query. How can I calculate it within direct Query?

 

I have column with dates and I need to add column with week number.

6 REPLIES 6
sixtoquiles
Helper II
Helper II

HI,

 

Any workaround to use WeekNum in direct query?

No news? Have the same problem

v-sihou-msft
Microsoft Employee
Microsoft Employee

 @pstanek

 

I reproduced same issue as yours, my power bi desktop version is 2.36.4434.381. Even I enable "unrestricted measures" in DirectQuery Option, I still get "not supported" error when adding a calculated column to get the week number from SQL table date column. 

Capture001.PNG

Capture00.PNG

I suggest you use DATEPART() get the week number on T-SQL query level. 

 

Regards,

Hi @v-sihou-msft how did you get on with finding a solution to this? I have allowed the unrestricted measures but still cannot get the WEEKNUM working on Direct Query mode.

 

 

2016-09-07 11_28_10-Ernslaw DQ - Power BI Desktop.png

Cheers,

ED.

Where can I find T SQL level?

 

File -> Options and Settings -> Options and check that you have allow unrestricted measure ticked.

Is this safe? I am afraid of incorrect results.

 

ankitpatira
Community Champion
Community Champion

@pstanek I cannot replicate your issue. I have directquery to sql server and can successfully create calc column with WEEKNUM function. Ensure you have latest version of pbi desktop and go to File -> Options and Settings -> Options and check that you have allow unrestricted measure ticked.

 

Capture.PNG

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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