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
yumhao
Employee
Employee

How to convert 1,2,3... to Monday, Tuesday, Wednesday,...

DirectQuery mode;

 

I use Weekday(table(date_column)) formula to get the weekday number: 1,2,3,...

How can I get the weekday name? i.e. Monday, Tuesday, Wednesday,...

 

Many thanks!

2 ACCEPTED SOLUTIONS
Phil_Seamark
Employee
Employee

Measure = 
VAR 
	myNumber = table[date_col]
RETURN 
	SWITCH(
		myNumber ,
		1 , "Monday" ,
		2 , "Tuesday" ,
		3 , "Wednesday" , 
		4 , "Thursday" ,
		5 , "Friday" ,
		6 , "Saturday" ,
		"Sunday"
	)

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

View solution in original post

Can you modify the SQL you use to get your data and use T-SQL function?

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

View solution in original post

7 REPLIES 7
Phil_Seamark
Employee
Employee

Or just try 

 

Weekday  = format(table[date_column],"DDDD")

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

the format() formular cannot be used in DirectQuery model....

 

Thanks anyway!

Hi @yumhao

 

Is your source data an SQL Server?


To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

My data source is Azure SQL DB, fyi.

 

Thanks!

Can you modify the SQL you use to get your data and use T-SQL function?

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

That's the last solution if i cannot make it in PBI lol.

 

Thanks!!!

Phil_Seamark
Employee
Employee

Measure = 
VAR 
	myNumber = table[date_col]
RETURN 
	SWITCH(
		myNumber ,
		1 , "Monday" ,
		2 , "Tuesday" ,
		3 , "Wednesday" , 
		4 , "Thursday" ,
		5 , "Friday" ,
		6 , "Saturday" ,
		"Sunday"
	)

To learn more about DAX visit : aka.ms/practicalDAX

Proud to be a Datanaut!

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.

Top Solution Authors