Forum Discussion

KWB's avatar
KWB
Frequent Visitor
9 years ago
Solved

Continuous x-axis issue

I have a problem when using dates in the X-Axis when the type is Continuous.

 

Our period data is stored as the last day of each month and when I put the period in the X-Axis, the axis doesn't line up with the data. This is the result:

 

 

The highlighted month should be February, as shown in the black popup, but the axis shows March.

 

When the type is changed to Categorical, it is now correct:

 

In case it's needed, the test data is:

 

 

I understand the dates need to be 'flexible' when chosing the continuous type in order for the dates to expand etc, but it can be misleading.

 

I know the other option could be to create another column to show the first day of the period instead of the last, but does anyone have any idea what is going wrong here? And what the best practice would be in this scenario? Ideally it would be better for Power BI to show the correct month without having to create another column.

 

Thanks

  • In order to properly show dates as "continuous" data, you need to be using dates from a date table, not your non-continuous fact table (that's categorical and why it is showing correctly as categorical).  After building the data table, you link your fact table dates to the date column in your date table.  The x-axis would then be from the date (or month, or year, etc.) column in the date table, not from your fact table.

5 Replies

  • tjd's avatar
    tjd
    Impactful Individual

    In order to properly show dates as "continuous" data, you need to be using dates from a date table, not your non-continuous fact table (that's categorical and why it is showing correctly as categorical).  After building the data table, you link your fact table dates to the date column in your date table.  The x-axis would then be from the date (or month, or year, etc.) column in the date table, not from your fact table.

    • rlu's avatar
      rlu
      Frequent Visitor

      Hi tjd ,

       

      How do I link my fact table dates to the date column? I'm having the same issue, but I created a custom Week column, which I'd like to use as my x-axis. Since it's a custom column, it is being stored as a Text data type rather than a Date data type. 

       

      Here is the formula for my custom Week column:

      weekInYear = year('calendar'[Date]) & " Week " & WEEKNUM('calendar'[Date])
       
      I'd like to show weekInYear as my x-axis. How can I convert it to a continuous field so that it shows Week 10 after Week 9 instead of after Week 1? 
       
      Thanks!
      • tjd's avatar
        tjd
        Impactful Individual

        Your Fact-table date column should be set up as Date type.  Your custom week should be set up in your calendar.  You then link your Calendar-Date column to your Fact-table date column (in relationships).  When creating an x-axis, you should use the date values from your Calendar table, not your Fact-table.  It will then be continuous across all dates.

  • v-jiascu-msft's avatar
    v-jiascu-msft
    Microsoft Employee

    KWB

     

    Hi,

     

    Could you tell me if your problem is solved? You can mark the right answer to help others if it's convenient for you.

     

    Best Regards!

    Dale