Forum Discussion

julsr's avatar
julsr
Icon for Continued Contributor rankContinued Contributor
1 year ago
Solved

Scatter Plot creates values in the axis x when multiple months are selected

Hi everyone,

 

I have a scatter plot with an issue: when multiple months are selected, it plots two days/months as a single point (for example, if viewing from Jan 01 to Feb 01, values for both first days appear at a single point on the x-axis). I created a column with yyyymmdd concatenated, but the scatter plot is still showing values up to 99 even when they don't exist in the calculated column. How can I solve this problem?

 
 

 

  • julsr's avatar
    julsr
    1 year ago

    Thanks! I found a solution, I used Julian Date format in my x axis and it worked without problem. This is the code.

    julian_measure=
    IF(
        ISBLANK(table[date]),
        0,
        DATEDIFF(DATE(1900, 1, 1), table[date], DAY)
    )

2 Replies

  • v-csrikanth's avatar
    v-csrikanth
    Icon for Community Support rankCommunity Support

    Hi julsr 

    Thanks for reaching out to the community!

    What you're experiencing in the scatter plot is a common issue when Power BI auto-aggregates or incorrectly interprets date-like fields — especially when using concatenated strings like yyyymmdd instead of proper date types.

    Here’s how to resolve it:

    1. Ensure your X-axis field is of Date data type, not text. Concatenated date strings (like yyyymmdd) can cause the scatter plot to treat them as categorical or numeric, leading to odd plotting behavior (like values going up to 99).
    2. Use a proper date column for the X-axis, such as a Date type column in your data model, not a calculated text-based column. You can always format this column visually if you want a custom display (e.g., "MMM dd").
    3. If you're using a calculated column, try creating it like this:
      ***************************************************
      DateFormatted = DATE(Year, Month, Day)
      ***************************************************
      Then use this in the scatter plot's X-axis.

    Also, make sure the X-axis is set to continuous (not categorical), which allows Power BI to render the data points appropriately over time.

    Let me know if this resolves the issue, and if it does, please mark it as the accepted solution so others can benefit!


    Best regards,
    Srikanth
    Power BI & Fabric Community Support Team

     

    • julsr's avatar
      julsr
      Icon for Continued Contributor rankContinued Contributor

      Thanks! I found a solution, I used Julian Date format in my x axis and it worked without problem. This is the code.

      julian_measure=
      IF(
          ISBLANK(table[date]),
          0,
          DATEDIFF(DATE(1900, 1, 1), table[date], DAY)
      )