Forum Discussion

badger123's avatar
badger123
Resolver I
7 years ago
Solved

Format date axis

Please can someone help me with formatting date axis... I've had so much trouble with this. 

 

Basically I have this chart, which is currently using date hierarchy, month: 

 

What I am trying to do is keep the chart as above but make the X axis formatted like: Jan 2018, Oct, 2018, Nov 2018 and so on... but when I remove the hierarchy and just do date, the chart looks like this:

 

Please help !!! :) 

 

  • Anonymous's avatar
    Anonymous
    7 years ago

    Create two columns in the same table as your date like this:

     

    date_display = FORMAT(dimCal[calDate],"mmm YYYY")
    date_BOM = EOMONTH(dimCal[calDate],-1) + 1
     
    Set date_display to sort by date_BOM, and use date_display on the x axis of your chart.
     
    The FORMAT statement returns text, and PowerBI has no idea it represents a date, so it will just be sorted alphanumerically. You cannot sort that by the calDate column because there are multiple date values per date_display values. date_BOM ensures you have one date per date_display value which PowerBI will sort according to the calendar.
     
     

1 Reply

  • Anonymous's avatar
    Anonymous
    Not applicable

    Create two columns in the same table as your date like this:

     

    date_display = FORMAT(dimCal[calDate],"mmm YYYY")
    date_BOM = EOMONTH(dimCal[calDate],-1) + 1
     
    Set date_display to sort by date_BOM, and use date_display on the x axis of your chart.
     
    The FORMAT statement returns text, and PowerBI has no idea it represents a date, so it will just be sorted alphanumerically. You cannot sort that by the calDate column because there are multiple date values per date_display values. date_BOM ensures you have one date per date_display value which PowerBI will sort according to the calendar.