Table of Contents
For data analysts and business intelligence specialists, the ability to accurately visualize performance trends over extended periods is a fundamental requirement. Generating a line chart that effectively aggregates and presents key metrics—such as sales, website traffic, or production volume—summarized by month and year is crucial. This type of visualization offers immediate, actionable insight into both cyclical seasonal patterns and underlying long-term growth trajectories. Achieving the correct level of temporal aggregation is paramount for accurate forecasting, effective capacity planning, and gaining a deep understanding of temporal dynamics within large and complex datasets.
Although Power BI provides robust, automated handling of date hierarchies, ensuring that the time series is displayed as a continuous, chronologically accurate flow often requires specialized configuration. Specifically, customizing the X-axis visualization to show a precise Month/Year format (e.g., 01/2023, 02/2023) without interruption or arbitrary grouping typically necessitates the creation of a calculated column. This calculation is performed using the powerful formula language, Data Analysis Expressions (DAX). By utilizing DAX, we force the time series to be treated as a single, sequential variable, overriding default behaviors that might otherwise group data by alphabetical month name or separate years unintentionally.
This comprehensive, step-by-step guide is designed to walk you through the precise technical process required in Power BI. We will detail how to manipulate your core date data and meticulously configure the visualization pane to successfully generate a clean, highly informative line chart. This final visualization will accurately display aggregated sales figures over time, defined by a continuous month and year axis, mirroring the professional example provided below.

Step 1: Preparing and Loading the Source Dataset
The first and most critical phase of any data visualization project is establishing a robust foundation by correctly importing and structuring the source data. For this tutorial, we rely on a straightforward sales data table, which must contain two fundamental columns: one designated for transaction dates and another holding the corresponding numerical sales figures. The integrity and structure of your initial dataset are crucial for performing accurate time-series analysis within Power BI. Specifically, Power BI requires that the date column is explicitly formatted as a date type and the metric column (Sales) is recognized as a numerical value suitable for aggregation.
To load the data, utilize the “Get Data” function available in the Power BI desktop interface, enabling connection to various sources such as local Excel or CSV files, or remote SQL databases. Once the import process is complete, you must verify the successful loading of the data within the Power BI environment. By navigating to the Data View, you can inspect the data model, ensuring that the date column has been correctly identified by Power BI as a proper date type. This is a non-negotiable prerequisite, as automatic date hierarchy creation and subsequent specialized DAX calculations depend entirely on this correct data type assignment.
Throughout this demonstration, we will be referencing a sample dataset provisionally named ‘my_data’. This table contains detailed daily sales records, serving as the essential input for our time-based analysis. Understanding the structure of this raw data, particularly the granularity of the date field, is vital before proceeding to the crucial step of generating a custom time axis. The exact structure employed for this exercise is illustrated in the visual representation below.

Step 2: Generating the Custom Month and Year Column using DAX
To guarantee that our resulting line chart provides a true chronological display of the time series, it is essential to bypass Power BI’s default sorting behavior. If we simply used the ‘Month’ field from the date hierarchy, the months would be ordered alphabetically (April, August, etc.), not sequentially (January, February, etc.). Therefore, we must introduce a new calculated column that combines the month and year into a single, chronologically unambiguous text string. This calculated column serves to override the inherent hierarchy splitting (Year, Quarter, Month, Day) which could otherwise compromise the linearity of the X-axis presentation.
The creation process begins in the modeling environment using Data Analysis Expressions (DAX). First, navigate to the top ribbon of the Power BI interface and select the Table tools tab. Within this specialized modeling section, locate and click the New column icon. This action initializes the DAX formula bar, preparing the environment for the input of our custom calculation designed to manipulate the existing date field into the required ‘MM/YYYY’ format.

Once the formula bar is active, input the following specific DAX expression. This formula leverages the highly versatile FORMAT function, which is designed to convert date, time, or numerical values into specified text strings. By applying the format string “MM/YYYY” to the raw ‘Date’ column within our ‘my_data’ table, we generate the desired combined time identifier. We name this new column month_year for clarity and easy retrieval in the Fields pane.
month_year = FORMAT('my_data'[Date], "MM/YYYY")
Upon successful execution of this DAX code, the new month_year column is seamlessly integrated into your underlying data model. The significance of this step cannot be overstated: this column now provides a stable, unique, and sequential text representation for every month/year combination present in the data. Although it is a text field, its content ensures that when placed on the X-axis, the visualization can be correctly sorted and displayed chronologically. Review the outcome of this powerful calculation in the snapshot of the data table provided below, confirming the precise structure of the new temporal key.

Step 3: Inserting the Line Chart Visualization
Having successfully engineered the required temporal column, the subsequent step is to transition from data modeling back to the visual reporting interface. This involves navigating to the primary visualization canvas where the report elements are designed and interacted with. This canvas is known as the Report View, which serves as the foundational workspace for all report construction activities within Power BI.
To access this environment, locate the distinct Report View icon positioned prominently on the left-hand navigation panel of the Power BI desktop application. Activating this icon shifts the application interface away from the Data View—where data transformation and calculated columns are handled—into the dedicated Report View, optimized specifically for graphical layout and design.

Once inside the Report View, direct your focus to the Visualizations pane, which is typically docked on the right side of the screen. This pane hosts the extensive library of chart types available for report creation. Carefully scroll through the options until you locate and select the Line chart icon. A single click on this icon instantly renders an empty, unconfigured container for the line chart onto your report canvas, confirming the visualization type we will be configuring.

This newly placed empty chart acts as a crucial placeholder, immediately ready to receive the necessary data fields that will define its structure, content, and final display logic. This initial insertion is a prerequisite for the final configuration steps, where we will map the temporal and quantitative variables to their respective axes to produce the desired time-series trend analysis.

Step 4: Populating and Refining the Chart Axes
The success of any time-series visualization hinges on the correct assignment of variables to the X and Y axes. The X-axis must represent the continuous time variable, while the Y-axis must quantify the metric being measured. This step requires precise manipulation of the field wells within the Visualizations pane, ensuring that the data is correctly aggregated and displayed chronologically, using the sorting power inherent in the original date field alongside the display clarity provided by our custom column.
We begin by establishing the necessary inputs into the chart field wells. Note that the sequence of dragging fields into the X-axis is critical for enabling the subsequent sorting technique:
First, drag the custom column, month_year, into the X-axis field well. This action initially forces the desired display format of ‘MM/YYYY’ onto the axis labels.
Second, immediately drag the original Date variable from the data model into the same X-axis field well. This seemingly redundant step is crucial because it provides the underlying chronological integrity required for proper sorting, which the text-based month_year column lacks by itself.
Finally, drag the quantitative measure, Sales, into the Y-axis field well. Power BI will automatically default to summarizing this measure, typically using the Sum aggregation, thus calculating the total sales value corresponding to each period on the X-axis.

The chart now contains the raw data, but the X-axis is cluttered and potentially showing multiple layers of the date hierarchy. The next phase involves a crucial cleanup to refine the axis display. We must leverage the original Date field for its chronological sorting hierarchy while maintaining the clean ‘MM/YYYY’ label format. We achieve this through two specific and mandatory adjustments within the X-axis field well:
Removing the Display Column: Click the ‘X’ or the dropdown menu next to the month_year variable and remove it from the X-axis. Although we relied on it initially to define the visual structure, keeping only the original Date field ensures that we utilize the inherent date hierarchy for accurate sorting, preventing issues where the chart might sort alphabetically instead of chronologically.
Modifying the Date Hierarchy: Click the drop-down arrow next to the remaining Date field on the X-axis. Power BI automatically imports the full date hierarchy (Year, Quarter, Month, Day). To achieve aggregation at the monthly level, delete the granular components: remove the Quarter and Day options from this hierarchy, leaving only the Year and Month components active. This modification ensures the line chart aggregates and displays data precisely at the monthly interval, achieving the desired continuous flow.

Through the meticulous execution of these field assignments and hierarchy refinements, you have successfully configured the visualization. The chart now displays the summed sales data, aggregated chronologically, against a continuous axis that is correctly defined by the sequential combination of month and year. This refined methodology yields a clear and highly accurate representation of temporal trends within your operational data.
The final output is a professional-grade time-series visualization that perfectly organizes the sum of sales over the reporting period by month and year, offering immediate insights into performance evolution.

Step 5: Expanding Your Power BI Skillset
While successfully configuring accurate time-series visualizations is a significant achievement, it represents only one facet of effective business intelligence within the Power BI ecosystem. To truly elevate your reporting capabilities and master complex analytical challenges, it is highly recommended that you delve deeper into complementary data manipulation and modeling techniques.
Key areas for continued development include achieving advanced proficiency in DAX functions beyond simple formatting, solidifying your understanding of data modeling relationships (such as one-to-many and many-to-many connections), and mastering efficient data loading and query optimization processes. These critical skills are essential complements to visualization expertise, enabling analysts to handle increasingly complex and massive datasets, ultimately leading to the production of more robust, dynamic, and interactive reports.
The following supplemental learning paths detail essential analytical tasks and optimization strategies that are frequently required in professional Power BI environments:
Exploring conditional formatting techniques for highlighting performance anomalies in key metrics.
Detailed guides on implementing custom sorting orders for arbitrary text fields using calculated columns.
Advanced deep dives into optimizing query performance and data refresh schedules for large-scale data models.
Cite this article
Mohammed looti (2025). Learning to Create Time-Series Line Charts in Power BI: A Step-by-Step Guide. PSYCHOLOGICAL STATISTICS. Retrieved from https://statistics.arabpsychology.com/power-bi-create-a-line-chart-by-month-and-year/
Mohammed looti. "Learning to Create Time-Series Line Charts in Power BI: A Step-by-Step Guide." PSYCHOLOGICAL STATISTICS, 12 Nov. 2025, https://statistics.arabpsychology.com/power-bi-create-a-line-chart-by-month-and-year/.
Mohammed looti. "Learning to Create Time-Series Line Charts in Power BI: A Step-by-Step Guide." PSYCHOLOGICAL STATISTICS, 2025. https://statistics.arabpsychology.com/power-bi-create-a-line-chart-by-month-and-year/.
Mohammed looti (2025) 'Learning to Create Time-Series Line Charts in Power BI: A Step-by-Step Guide', PSYCHOLOGICAL STATISTICS. Available at: https://statistics.arabpsychology.com/power-bi-create-a-line-chart-by-month-and-year/.
[1] Mohammed looti, "Learning to Create Time-Series Line Charts in Power BI: A Step-by-Step Guide," PSYCHOLOGICAL STATISTICS, vol. X, no. Y, ص Z-Z, November, 2025.
Mohammed looti. Learning to Create Time-Series Line Charts in Power BI: A Step-by-Step Guide. PSYCHOLOGICAL STATISTICS. 2025;vol(issue):pages.