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
KWelsh8144
Helper II
Helper II

Month Name from Date in Direct Query

I was able to get the month number in the direct query report, but would like to display the month name. SWITCH and FORMAT are not functions I can use in direct query. What are other options to return the month name?

 

Thanks!

1 ACCEPTED SOLUTION
v-yuezhe-msft
Employee
Employee

@KWelsh8144,

What error message do you get? And what is your data source? I make a test in Power BI Desktop October release( 2.63.3272.40461) by connecting to SQL Server with DirectQuery mode, switch function works as expected.

Monthname = SWITCH(Main[month], 1,"Jan", 02,"Feb",3,"Mar",4,"April", 5,"May",6,"Jun",7,"Jul",8,"August",9,"September",10,"October",11,"November",12,"December")

1.PNG

Regards,
Lydia

Community Support Team _ Lydia Zhang
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

3 REPLIES 3
KWelsh8144
Helper II
Helper II

I'm using the Oct 2019 version and connecting to an Oracle database. For whatever reason, when i type in 'switch' it comes up with a red underline as if i cannot use this. However,  when i copied and pasted what you have above, it works. thanks.

v-yuezhe-msft
Employee
Employee

 
Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
v-yuezhe-msft
Employee
Employee

@KWelsh8144,

What error message do you get? And what is your data source? I make a test in Power BI Desktop October release( 2.63.3272.40461) by connecting to SQL Server with DirectQuery mode, switch function works as expected.

Monthname = SWITCH(Main[month], 1,"Jan", 02,"Feb",3,"Mar",4,"April", 5,"May",6,"Jun",7,"Jul",8,"August",9,"September",10,"October",11,"November",12,"December")

1.PNG

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.