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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
adriancho_BI
Regular Visitor

How to get day name on Direct Query

Hello! 
I'm trying to get the day name (monday, sunday, etc.) and I'm using DirectQuery, this limit the formulas I can use. I mean that I can't use WEEKDAY OR WEEKNUM directly. And I would like to create a new column that tells me this field. My date column is datetime.

I already have different "Start of" columns, like: Start of Day, of hour, of Month, of Week

Thank you for the help.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @adriancho_BI ,

@bhanu_gautam Thanks for your concern about this case! I think your answer is pretty close.
After my testing, in fact you only need to use this DAX to create a measure, but it can't be achieved as a column:

 

Measure = FORMAT(MAX('test'[Resolved Date]), "dddd")

 

The final output is as below:

vjunyantmsft_0-1712130486788.png

The test environment I use is Direct Query connecting to SQL.

And if you just want to know what day of the week the date is, you can directly select the Format here:

vjunyantmsft_1-1712130627039.png

vjunyantmsft_2-1712130643294.png


Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

Hi @adriancho_BI ,

@bhanu_gautam Thanks for your concern about this case! I think your answer is pretty close.
After my testing, in fact you only need to use this DAX to create a measure, but it can't be achieved as a column:

 

Measure = FORMAT(MAX('test'[Resolved Date]), "dddd")

 

The final output is as below:

vjunyantmsft_0-1712130486788.png

The test environment I use is Direct Query connecting to SQL.

And if you just want to know what day of the week the date is, you can directly select the Format here:

vjunyantmsft_1-1712130627039.png

vjunyantmsft_2-1712130643294.png


Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Hi @adriancho_BI ,

And if you want to achieve this in a column, maybe you can try to use Power Query:
Here is my sample data:

vjunyantmsft_0-1712131607783.png

Use this M function to create a custom column:

Date.DayOfWeek([Resolved Date], Day.Monday) + 1

vjunyantmsft_1-1712131680888.png

Then create a conditional column:

vjunyantmsft_2-1712131730226.png

And the final output is as below:

vjunyantmsft_3-1712131752314.png

Then click "Close & Apply".

Here is the M function of these two steps:

#"Added Custom" = Table.AddColumn(#"Removed Columns", "Custom", each Date.DayOfWeek([Resolved Date], Day.Monday) + 1),
#"Added Conditional Column" = Table.AddColumn(#"Added Custom", "Custom.1", each if [Custom] = 1 then "Monday" else if [Custom] = 2 then "Tuesday" else if [Custom] = 3 then "Wednesday" else if [Custom] = 4 then "Thursday" else if [Custom] = 5 then "Friday" else if [Custom] = 6 then "Saturday" else if [Custom] = 7 then "Sunday" else null)



Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

bhanu_gautam
Super User
Super User

@adriancho_BI , You can try using format and left function 

 

Day Name =
SWITCH(
TRUE(),
LEFT(FORMAT([Date], "dddd"), 3) = "Mon", "Monday",
LEFT(FORMAT([Date], "dddd"), 3) = "Tue", "Tuesday",
LEFT(FORMAT([Date], "dddd"), 3) = "Wed", "Wednesday",
LEFT(FORMAT([Date], "dddd"), 3) = "Thu", "Thursday",
LEFT(FORMAT([Date], "dddd"), 3) = "Fri", "Friday",
LEFT(FORMAT([Date], "dddd"), 3) = "Sat", "Saturday",
LEFT(FORMAT([Date], "dddd"), 3) = "Sun", "Sunday",
""
)




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

Proud to be a Super User!




LinkedIn






thank you for the alternative, but I can't use directly the date column aparently because PBI shows me the error "Can't find name '[date]'". 

Use your date column and table name instead of that




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

Proud to be a Super User!




LinkedIn






You're right, that was the first thing I did after copy your suggestion /: then the error showed up.

Thanks anyways!

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

Top Solution Authors