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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.