Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Date (Year & Quarter) Sorting in a Graph

Hi All

 

I've got a supply and demand graph. Numbers wise my supply is a positive number and demand is a negative. The source is an excel spreadsheet. One of my columns is a text field which has for eg: 2021/Q1, 2021/Q2 and so on. I also added a colum that had a an actual date of the first day of each quater.  Thirdly (after you tubing) I created a calendar table for good measure.

 

No matter what I do, I cannot get a graph with years/quaters in the correct order. If I choose from the calendar version, I get year but it doesn't have the quater. If I use my column that has 20201/Q1 etc, it displays but not in order??? Any tips on what I may be doing wrong or should do a better way, I'm all ears?????

 

My graph is below to illustrate the lack of sorting!

 

Cheers

Rob

 

 

  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi Anonymous ,

    System Undersatnd ordering based on String data type because it's look like there are no seperate columns for year and It's Quarters. 
    Easy way to do it by creat indexing for Year/Qn column. and set created index column as order referance for Yr/Q column.
    Check this: https://www.youtube.com/watch?v=4xapOrfLvbg

    Keep Going 
    Best Regards,
    Nirav

4 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

    System Undersatnd ordering based on String data type because it's look like there are no seperate columns for year and It's Quarters. 
    Easy way to do it by creat indexing for Year/Qn column. and set created index column as order referance for Yr/Q column.
    Check this: https://www.youtube.com/watch?v=4xapOrfLvbg

    Keep Going 
    Best Regards,
    Nirav

  • Anonymous , this format itself is sortable.  On the three dot. Choose qtr year as the sort column. If this does not work

     

    Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

     

    Also refer how to use sort column - https://www.youtube.com/watch?v=KK1zu4MBb-c

  • v-lionel-msft's avatar
    v-lionel-msft
    Icon for Community Support rankCommunity Support

    Hi Anonymous ,

     

    If your X-axis column is a text type, you have to use the "Sort by column" feature to sort it, so I suggest you use the date hierarchy.

     

    Best regards,
    Lionel Chen

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

  • CGodfrey's avatar
    CGodfrey
    Frequent Visitor

    Replying to this late but I have another solution.

    When I tried dropping in the year and quarter into the X-value I couldn't get the order right. I would sort by quarter, or year and it would always end up wrong. Then I tried drilling up and down in the chart to get the years to appear below the quarters, no luck. I also tried these methods with and without concatenate in the Format Visuals -> X-axis -> Values menu. Nothing. 

    What ended up working is creating a hierarchy and then dropping the hierarchy into the visual instead of the individual values. Hope that helps someone else.