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
Anonymous
Not applicable

Format Date in Direct Query mode

Hi,

 

I have a date column in my metadata in simple date format.

 

Himanshu_13_0-1627303537336.png

 

How can I format it to be shown as below. I want it to be shown as Month'Year format in sorted manner.

 

Please Note: I'm using direct query mode so cant use format option.

 

Himanshu_13_1-1627303570470.png

 

Regards,

Himanshu

 

7 REPLIES 7
Anonymous
Not applicable

Anyone has a idea how to format a simple date to"YYYYMM"

format in direct query?

 

This will resolve my issue.

Samarth_18
Community Champion
Community Champion

Hi @Anonymous 

 

You can add below format in custom formatting to get your desired output.

Samarth_18_1-1627304690680.png

 

Thanks

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

Anonymous
Not applicable

I'm getting this output

 

Himanshu_13_0-1627305648611.png

 

 

How to get month wise break up like below:

 

Himanshu_13_1-1627305679311.png

 

You can create two calculated column one for format your date and another column for sorting of your formatted date column. Below are the required code for both format and sort date column.

formatted_date = FORMAT(date_table[Date],"MMM YYYY")
Sort = FORMAT(date_table[Date], "YYYYMM")

 

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

Anonymous
Not applicable

@Samarth_18  Yes this is easy and can be done when in import mode but format doesnt work in Direct query mode hence facing this issue. 

 

I have created the Month'Year using concat but sorting is the issue. Sorting is not happening correctly for me.

 

Himanshu_13_0-1627306380361.png

 

selimovd
Super User
Super User

Hey @Anonymous ,

 

why not? Custom format works also in DirectQuery mode, I just tried it:

selimovd_0-1627304112540.png

 

And the storage mode is DQ:

selimovd_1-1627304126831.png

 

If you need any help please let me know.
If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
 
Best regards
Denis
 
Anonymous
Not applicable

I want to present the data in the below format, can you please help me with the steps how to use it as its not working for me at the moment.

 

Himanshu_13_0-1627304920873.png

Its showing me very incorrect data.

 

Himanshu_13_1-1627305056745.png

 

It should be something like below , i have created some calculated column n done concat but sorting is not working properly.

 

Himanshu_13_2-1627305101861.png

 

 

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.