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

Sort Month Year for large amount of data

Dear All,

I have a table with transaction date and groups, i need bar chart month wise (different years), but i am unable to sort the month year. I tried all the ways mentioned on web. but nothing works. Kindly help.

 

Thanks,

Jesly Thomas

1 ACCEPTED SOLUTION
parry2k
Super User
Super User

@jesly_ajin I believe you have date dimension in your model. Add following two column in it.

 

Month = FORMAT( YourDateTable[Date], "MMM, yy" )

Month Sort = FORMAT( YourDateTable[Date], "YYYY-MM" )

Select Month column, go to modelling tab, on drop down by Sort By Column choose, Month Sort

 

In your visual, use Month column from date dimension and everything will work.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

10 REPLIES 10
parry2k
Super User
Super User

@jesly_ajin I believe you have date dimension in your model. Add following two column in it.

 

Month = FORMAT( YourDateTable[Date], "MMM, yy" )

Month Sort = FORMAT( YourDateTable[Date], "YYYY-MM" )

Select Month column, go to modelling tab, on drop down by Sort By Column choose, Month Sort

 

In your visual, use Month column from date dimension and everything will work.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Hi @parry2k 

 

I have used the below formulas. But still i get the above mentioned error.

Month = FORMAT(LTEQUIPMENTALLOCATIONHISTORY[TRANSDATE], "MMM, yy" )
Month Sort = FORMAT( LTEQUIPMENTALLOCATIONHISTORY[TRANSDATE], "YYYY-MM" )PBIError2.JPG

Hi @parry2k ,

 

Now the error went, i changed one of ur formula to Month = FORMAT(LTEQUIPMENTALLOCATIONHISTORY[TRANSDATE], "MMM, yyyy" ). But, still the sort is not working.

NOw my formulas are: 

Month = FORMAT(LTEQUIPMENTALLOCATIONHISTORY[TRANSDATE], "MMM, yyyy" )
Month Sort = FORMAT( LTEQUIPMENTALLOCATIONHISTORY[TRANSDATE], "YYYY-MM" )
Please help. eagerly waiting for help.

When you say the sort is not working, do you mean that you're still getting the same error when using the Sort By Another Column feature, or that the order is wrong in the visual?  What (incorrect) order are they in now?  I ask because this looks like it should be working. 

 

If you're still getting the error message that tells you that you can't sort because there's more than one value, double check for nulls or blanks in your data. 

You can also create a measure to test the uniqueness of each "MMM, yyyy"/"yyyy-MM" pairing. If you put this measure into a card, it should display zero.  If not, it should be a count of [Months] that have multiple [Month Sort]s, which is preventing your Sort By Another Column.

TestForUniquePairs = COUNTROWS(FILTER(SUMMARIZE( VALUES(LTEEQUIPMENTALLOCATIONHISTORY[Month], "Pairs", DISTINCTCOUNT(LTEEQUIPMENTALLOCATIONHISTORY[Month Sort])), [Pairs]>1))

@Cmcmahan,

The error - Sort by another is gone.

But, still the order is incorrect.

I tried the measure formula - it is giving the result as one on the card.

Kindly help.

 

 

Huh.  The fact that it's giving you a result of one is weird, but if the Sort By Another Column is working, we can ignore that.

 

What order is it currently being displayed in? Can you take a picture of the visual?

 

 

@jesly_ajin at this point I would highly recommend to share pbix file with sample data and remove any sensitive information before sharing. It is pretty straight forward task and should work. Can you share file?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Please help me with a suitable solution.

@parry2k 

I tried your method, but i am getting the below error. kindly help.PBIError1.JPG

@jesly_ajin can you share expression of new columns you added

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

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.