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
patquevillon
New Member

Date Sorting in Line Chart

Hello,

 

I want to display data ranging from November 2016 to now (March 2017, but will keep growing) in a line chart. My date field is a date (properly recognized as a date Hierarchy) and I want to keep the hiearchy mode and provide my users the ability to drill up-down through days, months, quarters, years.

 

Issues are the following: Power BI does not sort or aggregate properly.

 

- At the Day level the data is aggregated on the day numerical value (1 thru 30/31) so my axis has 0-31 data points instead of the expected 120 or so entries for the last 4 months.

- At the month level the data is sorted by month, but irregardless of the year. So I get : Jan, Feb, Mar, Nov, Dec Instead of the expected Nov, Dec, Jan, Feb, Mar (Nov and Dec being in 2016 while Jan, Feb, Mar are in 2017).

- At the Quarter level: same as for months. Q1 comes before Q4. I am expecting Q4 (2016) to come before Q1 (2017)

 

Any solutions to this ?

 

examples:

 

 

 

 

 

 

 

 

thanks

1 ACCEPTED SOLUTION
parry2k
Super User
Super User

First question comes in my mind, do you have dedicated continuous calendar table? if not follow this link as example to create one and then use the fields from calendar table on your axis to achieve what you are looking for. Let me know if you need further help.

 

 

Thanks,

P



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

3 REPLIES 3
parry2k
Super User
Super User

First question comes in my mind, do you have dedicated continuous calendar table? if not follow this link as example to create one and then use the fields from calendar table on your axis to achieve what you are looking for. Let me know if you need further help.

 

 

Thanks,

P



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.

Thank you Parry2k!

 

You put me on the right track. I ended up creating a Calendar table using your instructions (not as many fields and tweaking the syntax as my French Operationg System doesn't like the ";" ).

 

I was then able to link my source table to the Calendar on the date field and simply use the Calendar day, year-month and year-quarter as the elements of my axis hierarchy. Works like a charm.

Good to hear. Always get good feeling when there is a solution.

Cheers



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.