cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
yumhao Frequent Visitor
Frequent Visitor

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

Accepted Solutions
Phil_Seamark Super Contributor
Super Contributor

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

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

Phil_Seamark Super Contributor
Super Contributor

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

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 Super Contributor
Super Contributor

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

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

Phil_Seamark Super Contributor
Super Contributor

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

Or just try 

 

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

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

Proud to be a Datanaut!

yumhao Frequent Visitor
Frequent Visitor

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

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

 

Thanks anyway!

Phil_Seamark Super Contributor
Super Contributor

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

Hi @yumhao

 

Is your source data an SQL Server?


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

Proud to be a Datanaut!

yumhao Frequent Visitor
Frequent Visitor

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

My data source is Azure SQL DB, fyi.

 

Thanks!

Phil_Seamark Super Contributor
Super Contributor

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

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

yumhao Frequent Visitor
Frequent Visitor

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

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

 

Thanks!!!

Helpful resources

Announcements
Ask Amir Anything

Exclusive LIVE Community Event No. 2 – Ask Amir Anything

Next in our Triple A series: Ask Amir Netz questions about the latest updates, features and future.

October 2019 Community Highlights

October 2019 Community Highlights

October was a busy month in the community. Read the recap article to learn about some of the events and content.

New Solution Badges

New Solution Badges

Two waves of brand new solution badges are coming! Read the article for more information on our new community badges.

Analytics in Azure virtual event

Analytics in Azure virtual event

Experience a limitless analytics service built to ingest, prep, manage, and serve data for immediate use in Power BI.

Users Online
Currently online: 268 members 2,557 guests
Please welcome our newest community members: