Forum Discussion

AlB's avatar
AlB
Community Champion
5 years ago

Avoid showing time on date axis

Hi all,

We have a simple chart with dates on the x axis. With a slicer, the user can select the period to be shown. For instance, if "Last week" is chosen:

 All fine there. If however we choose a shorter period, for example "Last 3 days", we get :

Note the x axis is now showing not only the dates but also times: 26 Jun 00:00, 26 Jun 06:00, 26 Jun 12:00 etc

How can we force the x-axis to show only dates? For the latter chart, it should only show 26 Jun, 27 Jun and 28 Jun, which is what the three bars correspond to.

Notes: the Date column used in the x axis is of type date  (not Date/time) and we would need to keep the x axis as continuous. The selectable periods go from a couple of days up to a full year, with day granularity.

 

Many thanks

 

PS: Any idea? MFelix , TomMartens Pragati11 parry2k  Fowmy   mahoneypat 

Thanks

9 Replies

  • v-jingzhang's avatar
    v-jingzhang
    Community Support

    Hi AlB 

     

    Update 2:

    Here is the feedback: "This is currently by design without any formatting options to change. We will review and analyze current logic but no ETA at this time."

     

    So for now I suggest voting for the idea at bottom of this post.

     

    ===================================

    Update:

    I have reported this issue internally (IcM number: 248625217). Will update here if get any feedback. Thank you.

     

    ===================================

    Currently there is no workaround to format the dates in X Axis to remove the time part when of type continuous. I found a related idea Allow Formatting of Dates in X Axis with Continuous Data

     

    Regards,
    Community Support Team _ Jing

  • mahoneypat's avatar
    mahoneypat
    Microsoft Employee

    AlB I couldn't find a workaround with the native visual, so I would just make it with the charticulator visual.  I saw same formatting behavior with a line chart and just made a simple charticulator one (on right).  You should also be able to use the Tick Format option on the x axis in the plot segment to get it to show mmm dd (but I haven't figured out the D3 syntax for it yet).

     

    Update: I expanded the slicer after I posted the above and it does not look pretty on the x axis. Not the solution (at least the way I did it).

     

    Pat

     

     

  • AlB as others described when it is a continuous type on x-axis you cannot control the format of the date. It does pick up the format based on number of visible dates. It is a known functionality..

    • MFelix's avatar
      MFelix
      Super User

      Hi AlB ,

       

      Has previous refer this is a functionality and you cannot control it.

       

  • TomMartens Good article but too much to handle format on the x-axis in continuous. Seems like overkill for that simple talk whereas, in my opinion, it should be out-of-the-box functionality to handle the format. Thanks for sharing.

    • TomMartens's avatar
      TomMartens
      Super User

      Hey parry2k , I agree the ideas are a lot to digest for a small task like formatting the date if the axis label is of type continuous, unfortunately, there is no other way, at least no tat the moment.

       

      Regards,

      Tom

  • AlB's avatar
    AlB
    Community Champion

    Thanks mahoneypat  parry2k  MFelix 

    TomMartens  Thanks very much for the article. It doesn't seem to address my problem though. On the continuous axis, they aggregate down to week level but I want to keep the granularity at day level. It is when I am only showing two or three days that I get this annoying daytimes in the middle. The rest (when showing one or several months) is fine

     

    Please accept the solution when done and consider giving a thumbs up if posts are helpful. 

    Contact me privately for support with any larger-scale BI needs, tutoring, etc.