Categories: DAX
Tags:

You will be able to create a Dashboard like this:

In Part 1 We did Sales analysis with Time Intelligence functions in Power BI, in this part we will focus on Sales Manager wise Performance Analysis

Below are Power BI questions, along with suggested DAX measures that focus on Salesperson/Regional Manager-wise analysis.

Get the Dataset Here : https://github.com/slidescope/data/blob/master/SS_Superstore_With_Images.xlsx

1. What is the total sales by each Regional Manager?

Total Sales = SUM(Orders[Sales])

Use a Matrix or Bar chart with Regional Manager on axis and Total Sales as values.

Use SUMMARIZE Function to create Managerwise Summary Table

2. Who is the top-performing Regional Manager by sales?

Top Regional Manager Sales= 
CALCULATE(
    MAXX(
        VALUES(Orders[Regional Manager]), 
        CALCULATE(SUM(Orders[Sales]))
    )
)

Top Regional Manager Name = 
VAR TopManagerTable =
    TOPN(
        1,
        SUMMARIZE(
            Orders,
            People[Regional Manager],
            "TotalSales", CALCULATE(SUM(Orders[Sales]))
        ),
        [TotalSales],
        DESC
    )
RETURN
    SELECTCOLUMNS(TopManagerTable, "Manager", People[Regional Manager])

3. What is the profit margin per Regional Manager?

Profit Margin % = 
DIVIDE(
SUM(Orders[Profit]),
SUM(Orders[Sales])
)

Then use the measure in any Visual
Or use Summarize to create a Table

4. What is the average sales per order by each manager?

Avg Sales per Order = 
AVERAGEX(
VALUES(Orders[Order ID]),
CALCULATE(SUM(Orders[Sales]))
)

❓ Why use AVERAGEX in Question 4:


✅ Purpose of This Measure:

To calculate the average amount of sales per order, grouped by Sales Manager (or any other dimension like Region).


🔍 Why AVERAGEX?

AVERAGEX is an iterator function — it goes row by row over a table, evaluates an expression for each row, and then averages the result.


📘 Breakdown of the Formula:

VALUES(Orders[Order ID])
  • This generates a list of unique Order IDs in the current context (e.g., per Sales Manager).
CALCULATE(SUM(Orders[Sales]))
  • For each Order ID, this gives the total sales amount for that specific order.

So AVERAGEX(...) computes:

The average of total sales per order, by iterating over each unique Order ID.


🔁 What If You Used AVERAGE(Orders[Sales]) Instead?

  • That would just return the average of all individual sales line items, not grouped by order.
  • It’s inaccurate if an order has multiple line items, because it would count each line item’s sales separately, skewing the result.

🧠 Real-World Analogy:

Suppose one order has 3 products (line items). You want to know the average total order value, not average per line item.

That’s why you:

  1. Group by Order ID
  2. Sum sales per order
  3. Then average those order-level totals

✅ Summary:

DAX FunctionUse Case
AVERAGEXAverage over aggregated values (like order totals)
AVERAGEAverage over column values (like line-item sales)