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
rkumar
Helper III
Helper III

Short Date Format(01 Jan 2018)

Hi All,
We need to convert date from any format to dd mmm yyyy format eg '2018-03-21' to '21 Mar 2018' and sort it. 
Is is possible to do that .

 

Thank You

1 ACCEPTED SOLUTION
v-yuta-msft
Community Support
Community Support

Hi rkumar,

 

To change format, click Modeling->Format->14 March, 2001(d MMMM,yyyy).

10.PNG

To sort, right click on the column then click “Sort Ascending” or “Sort Descending”.

11.PNG

 

Regards,

Jimmy Tao

View solution in original post

8 REPLIES 8
v-yuta-msft
Community Support
Community Support

Hi rkumar,

 

To change format, click Modeling->Format->14 March, 2001(d MMMM,yyyy).

10.PNG

To sort, right click on the column then click “Sort Ascending” or “Sort Descending”.

11.PNG

 

Regards,

Jimmy Tao

vanessafvg
Super User
Super User

@rkumar where are you trying to sort it and in what?  most visuals allow you to sort

 

as for the format

 

format(datecolumn, "d MMM yyyy")

 

 





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




We are trying this in waterfall chart.

We have a date column with date format as '01 March 2017' . When we use this in Category field, it is showig fine in x axis . Data is showing fine and we are able to sort also.
But the requirement is to show date as '01 Mar 2017' now when we make the required changes in PowerBI or database to achieve this this, the new column datatype changes from date to text and then the sorting fails.


@rkumar then use a numerical date to sort the text date by as, i.e

 

ie under modelling tab use sort by column and use a numerical expression of the date to sort by

 

does that make sense?





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




Hi Vanessafvg,
Thanks for the reply .
Yes I already tried same but it gives error :
We cant sort the 'shortdate' column by 'calendar_date'. There cant be more than one value in 'calendar_date' for the same value in 'shortdate'. Please choose a different column for sorting or update the date in 'calendar_date'

This is because more than one records entered on the same date.

1.PNG

@rkumar you need a date table, because you have duplicates, a date table will remove the duplication, create a date table and create  relationship between the two tables on the date then use a numerical date to sort on from the date table and use the short date from the date table





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




The date_id column in the above screenshot is from date table (W_Calendar_D) and this tabe has all distinct dates. The duplicates are in Product table. somehow while sorting its not removing data (As the message says, There cant be more than one value in Date_id for the same value in ShortMonthDate .) 

"Do we need distinct values in both tables "

@rkumar what i am saying is you should be using your date table values not the other table to do the sort by

 

effectively you should have a numerical date in your transaction table, that should link  (relationship) to a numerical date in your date table in your date table you should have the short date time, you then sort the short date time by the the date in the date table.  The short date time should not be in the transaction table. not if you want to use it in this context, make sense?





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




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.