Forum Discussion

Walt1010's avatar
Walt1010
Icon for Helper V rankHelper V
1 year ago
Solved

Aligning X labels from Bins

I have created a bin of incoming calling times, of 1-hour intervals.  The calls start at 9:00, and so the first bin with values is 9-10. When I then create a column chart, using the bin as the X axis, the text under the first column is 8:00, which is confusing to the user. How do I change it, so that the description of each bin range under each column makes more sense?

  • Create a new text column with your desired bin labels like "9:00 - 10:00", then use that column as the X-axis in your chart instead of the automatic bin numbers. This ensures the labels match your actual bins and avoid showing "8:00".

3 Replies

  • Create a new text column with your desired bin labels like "9:00 - 10:00", then use that column as the X-axis in your chart instead of the automatic bin numbers. This ensures the labels match your actual bins and avoid showing "8:00".

  • Hi Walt1010 ,

     

    Yeah, this is a common issue when using auto-generated bins in Power BI — the visual engine sometimes centers the bin label based on the underlying numeric value rather than the actual range.

    Here’s a cleaner way to fix it:

    1. Don’t use the auto binning feature. Instead, create a custom column in Power Query or DAX that defines your bins explicitly.

      Example in Power Query:

       if [CallTime] >= #time(9,0,0) and [CallTime] < #time(10,0,0) then "09:00 - 10:00"
       else if [CallTime] >= #time(10,0,0) and [CallTime] < #time(11,0,0) then "10:00 - 11:00"
       ...

    Or in DAX:

       CallTimeBin = 
       SWITCH(
           TRUE(),
           [CallTime] >= TIME(9,0,0) && [CallTime] < TIME(10,0,0), "09:00 - 10:00",
           [CallTime] >= TIME(10,0,0) && [CallTime] < TIME(11,0,0), "10:00 - 11:00",
           ...
       )
    1. Use this new column as your X-axis in the column chart. This way, the labels will match exactly what you want users to see, and you avoid the confusion with centered values like 8:00.

    Let me know if you want help automating the bin generation for a dynamic range.

    If my response resolved your query, kindly mark it as the Accepted Solution to assist others. Additionally, I would be grateful for a 'Kudos' if you found my response helpful.
    translation and formatting supported by AI