Tools Advisor | Power BI

Power BI Sales Data Matrix Visualization Setup

Learn how to display sales data by quarters for selected years in Power BI using a Date table, slicer functionality, and matrix visualization. Comprehensive guidance and DAX code provided.


Empty image or helper icon

Prompt

Hello All,

I am working on a project where I want to show something similar but years as horizontal and qtrs as vertical for sales. So want to show 5 years past sales data by qtr depending on which year I select in the slicer.

E.g.:
Qtr 2019 2020 2021 2022 2023 2024
Q1
Q2
Q3
Q4

Answer

Problem Analysis:

To display past sales data by quarters for selected years in a matrix format in Power BI, a specific setup involving the slicer functionality and matrix visualization is required.

Strategic Solution Development:

  1. Create a Date table in Power BI with columns for Year, Quarter, and Sales data.
  2. Generate a relationship between the Date table and the Sales data table.
  3. Build a slicer that allows users to select a specific year.
  4. Utilize a matrix visualization to present the sales data by quarters horizontally for the selected years vertically.

Comprehensive Advice:

  1. Date Table Creation:

    • Create a Date table with columns for Year (e.g., 2019 to 2024), Quarter (Q1 to Q4), and Sales data.
    • Use DAX functions like CALENDAR and ADDCOLUMNS to generate the required date range.
  2. Relationships:

    • Ensure there is a relationship between the Date table (Year, Quarter) and your Sales data table (Sales amount).
  3. Slicer Setup:

    • Incorporate a slicer that includes the Year column from the Date table.
    • This slicer will allow users to choose the specific year they want to view.
  4. Matrix Visualization:

    • Place the Quarter column from the Date table on the Rows shelf of a matrix visualization.
    • Drag the Year column from the Date table to the Columns shelf.
    • Populate the values within the matrix with the aggregated sales data.

Code-Based Solution:

Date Table = 
ADDCOLUMNS(
    CALENDAR(DATE(2019, 1, 1), DATE(2024, 12, 31)),
    "Year", YEAR([Date]),
    "Quarter", "Q" & FORMAT([Date], "Q")
)

Detailed Explanations:

  • Creating a Date table provides a comprehensive view of the date range across the selected years and quarters.
  • Establishing relationships ensures that the data is correctly associated between tables for accurate reporting.
  • The matrix visualization allows for a clear representation of sales data by quarters, organized based on the selected year.

By following these steps and utilizing the provided DAX code, you can effectively showcase past sales data by quarters for the chosen years using Power BI.

Create your Thread using our flexible tools, share it with friends and colleagues.

Your current query will become the main foundation for the thread, which you can expand with other tools presented on our platform. We will help you choose tools so that your thread is structured and logically built.

Description

Learn how to display sales data by quarters for selected years in Power BI using a Date table, slicer functionality, and matrix visualization. Comprehensive guidance and DAX code provided.