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
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
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.