Logic Visualizer | Excel

Sales Data Analysis

This process involves retrieving sales data from a table, calculating total and discount sales for each row, filtering the data, grouping it by product, and summarizing the sales data to calculate regular sales, discounted sales, and savings.


Empty image or helper icon

This Query related with thread "DAX Code for Modifying Sales Table"

Prompt

Sales Modified = 
        SUMMARIZE(
            FILTER(
                ADDCOLUMNS(
                    ALL(Sales),
                    "Total Sales", [Qty] * [Price],
                    "Discount Sales", [Qty] * [Price] * (1 - [Discount])
                ),
                [Total Sales] <> [Discount Sales]
            ),
            [Product],
            "Total Regular Sales", SUM([Total Sales]),
            "Total Discounted Sales", SUM([Discount Sales]),
            "Discount Savings", SUM([Total Sales]) - SUM([Discount Sales])
        )

Answer

START

1. Retrieve sales data from the Sales table.
2. For each row in the sales data, perform the following steps:
    3. Calculate the total sales for the row by multiplying the quantity and price.
    4. Calculate the discount sales for the row by multiplying the quantity, price, and (1 - discount).
    5. Add these calculated values as new columns to the sales data.
6. Filter the sales data to include only rows where the total sales is not equal to the discount sales.
7. Group the filtered sales data by the product.
8. Summarize the grouped data by calculating the total regular sales, total discounted sales, and discount savings.
9. Return the summarized data as the output.

END

Flowchart

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

This process analyzes sales data retrieved from the Sales table. For each row in the data, it calculates the total sales by multiplying the quantity and price. It also calculates discount sales by multiplying the quantity, price, and (1 - discount). These calculated values are added as new columns to the sales data. The data is then filtered to include only rows where the total sales is not equal to the discount sales. Next, the filtered data is grouped by the product. Finally, the grouped data is summarized by calculating the total regular sales, total discounted sales, and discount savings. The summarized data is returned as the output of the process.