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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Kolumam
Post Prodigy
Post Prodigy

How do I convert a text Month field to number and sort it

Hi All,

 

I have two fields. One is Month which is just a text field. Other is month number which uses a switch to convert the month to number. When I try to sort the Month by Month Number it says that the column is already sorted. See the below images. How do I fix this? Please help.

 

dax.JPGdaxx.JPG

1 ACCEPTED SOLUTION

It is very difficult to help you if i do not know your data's structure.  I would create a relatioship from the Month column in the Calendar Table to the Month column of this new table.  The using a RELATED() function, i will bring over the numeric column into the Calendar Table.  In the Calendar Table, i will click on any cell in the Month column and then go to Sort by column.  In any visual, i will now drag the Month from the Calendar Table.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

10 REPLIES 10
Ashish_Mathur
Super User
Super User

Hi,

 

It looks like there is a circular dependency happening there.  I always create a the 2 column table by typing it out and then the Sort by column works very well.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi Ashish,

 

How do I acheive this?

Hi,

 

Create the 2 column table in MS Excel.  In PowerBI desktop, go to Home > Enter Data and paste the Table there.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi Ashish, 

 

I have done that but how do I sort it using that column? because currently it is showing the list of columns which belongs to that column.

It is very difficult to help you if i do not know your data's structure.  I would create a relatioship from the Month column in the Calendar Table to the Month column of this new table.  The using a RELATED() function, i will bring over the numeric column into the Calendar Table.  In the Calendar Table, i will click on any cell in the Month column and then go to Sort by column.  In any visual, i will now drag the Month from the Calendar Table.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi Ashish,

 

I created the same columns in excel and created a relationship between the two tables and it worked. Thanks for guiding me.

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi Ashish,

 

Is it possible to calculate running total based on just a month?

Share some data and show the expected result.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi Ashish,

 

Please refer to this thread. I have raised a new case.

 

http://community.powerbi.com/t5/Desktop/Calculating-running-total-based-on-month/m-p/426337#M196184

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.