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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
vedran
Frequent Visitor

Converts day of week to number from 1 to 7

Hi guys

 

In (calculated) dimension/calendar table, I have Day(s) of week:

Mon

Tue

Wed

Thu

Frid

Sat

Sun

Mon

Tue..

 

Which DAX expression I can use to have this values in new column as a number:

1 or 01

2

3

4

5

6

7

1

2...

 

 

Thank you

1 ACCEPTED SOLUTION
vedran
Frequent Visitor

I solved..

 

WEEKDAY Function (DAX) is for that

https://msdn.microsoft.com/en-us/library/ee634550.aspx?f=255&MSPPError=-2147217396 

 

DayNo = WEEKDAY(DateKey[Date];2)

View solution in original post

3 REPLIES 3
mfbati
Regular Visitor

In Power Query DayOfWeek function returns a number from 0 to 6. If you need a number between 1 and 7 in Power Query, you can use this code:

 

While the first day of a week is Sunday:

DayNo = Date.DayOfWeek([DateColumn], Day.Monday)+1


While the first day of a week is Monday:

DayNo = Date.DayOfWeek([DateColumn], Day.Tuesday)+1

 

Thanks, it is working fine.

vedran
Frequent Visitor

I solved..

 

WEEKDAY Function (DAX) is for that

https://msdn.microsoft.com/en-us/library/ee634550.aspx?f=255&MSPPError=-2147217396 

 

DayNo = WEEKDAY(DateKey[Date];2)

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.